Esempio n. 1
0
 static public void addClassToFact(BlueprintCharacterClass class_to_add, BlueprintArchetype[] archetypes_to_add, DomainSpellsType spells_type, BlueprintUnitFact f)
 {
     if (f is BlueprintAbility)
     {
         addClassToAbility(class_to_add, archetypes_to_add, (f as BlueprintAbility));
     }
     else if (f is BlueprintActivatableAbility)
     {
         addClassToBuff(class_to_add, archetypes_to_add, (f as BlueprintActivatableAbility).Buff);
     }
     else if (f is BlueprintFeatureSelection)
     {
         if ((f as BlueprintFeatureSelection).Group == FeatureGroup.Feat ||
             (f as BlueprintFeatureSelection).Group == FeatureGroup.WizardFeat ||
             (f as BlueprintFeatureSelection).Group == FeatureGroup.RogueTalent
             )
         {
             return;
         }
         foreach (var af in (f as BlueprintFeatureSelection).AllFeatures)
         {
             if (af.HasGroup(FeatureGroup.Feat, FeatureGroup.WizardFeat, FeatureGroup.RagePower, FeatureGroup.RogueTalent))
             {
                 return;
             }
             addClassToFact(class_to_add, archetypes_to_add, spells_type, af);
         }
         addClassToFeat(class_to_add, archetypes_to_add, spells_type, (f as BlueprintFeatureBase));
     }
     else if (f is BlueprintProgression)
     {
         addClassToProgression(class_to_add, archetypes_to_add, spells_type, (f as BlueprintProgression));
     }
     else if (f is BlueprintFeature)
     {
         addClassToFeat(class_to_add, archetypes_to_add, spells_type, (f as BlueprintFeatureBase));
     }
 }
Esempio n. 2
0
        static void addClassToProgression(BlueprintCharacterClass class_to_add, BlueprintArchetype[] archetypes_to_add, DomainSpellsType spells_type, BlueprintProgression progression)
        {
            progression.Classes    = progression.Classes.AddToArray(class_to_add);
            progression.Archetypes = progression.Archetypes.AddToArray(archetypes_to_add);

            foreach (var entry in progression.LevelEntries)
            {
                foreach (var feat in entry.Features)
                {
                    addClassToFact(class_to_add, archetypes_to_add, spells_type, feat);
                }
            }

            addClassToFeat(class_to_add, archetypes_to_add, spells_type, progression);
        }
Esempio n. 3
0
        public static void addClassToDomains(BlueprintCharacterClass class_to_add, BlueprintArchetype[] archetypes_to_add, DomainSpellsType spells_type, BlueprintFeatureSelection domain_selection)
        {
            var domains = domain_selection.AllFeatures;

            foreach (var domain_feature in domains)
            {
                addClassToFact(class_to_add, archetypes_to_add, spells_type, domain_feature);
            }
        }
Esempio n. 4
0
        static public void addClassToFeat(BlueprintCharacterClass class_to_add, BlueprintArchetype[] archetypes_to_add, DomainSpellsType spells_type, BlueprintFeatureBase feat)
        {
            foreach (var c in feat.ComponentsArray.ToArray())
            {
                if (c is IncreaseSpellDamageByClassLevel)
                {
                    var c_typed = c as IncreaseSpellDamageByClassLevel;
                    c_typed.AdditionalClasses = c_typed.AdditionalClasses.AddToArray(class_to_add);
                    c_typed.Archetypes        = c_typed.Archetypes.AddToArray(archetypes_to_add);
                }
                if (c is AddFeatureOnApply)
                {
                    var c_typed = c as AddFeatureOnApply;
                    addClassToFact(class_to_add, archetypes_to_add, spells_type, c_typed.Feature);
                }
                else if (c is AddFeatureOnClassLevel)
                {
                    var c_typed = c as AddFeatureOnClassLevel;
                    c_typed.AdditionalClasses = c_typed.AdditionalClasses.AddToArray(class_to_add);
                    c_typed.Archetypes        = c_typed.Archetypes.AddToArray(archetypes_to_add);
                    addClassToFact(class_to_add, archetypes_to_add, spells_type, c_typed.Feature as BlueprintUnitFact);
                }
                else if (c is AddFeatureIfHasFact)
                {
                    var c_typed = c as AddFeatureIfHasFact;
                    addClassToFact(class_to_add, archetypes_to_add, spells_type, c_typed.Feature as BlueprintUnitFact);
                }
                else if (c is AddSpecialSpellList && spells_type == DomainSpellsType.SpecialList)
                {
                    var c_typed = c as AddSpecialSpellList;
                    if (c_typed.CharacterClass != class_to_add)
                    {
                        var c2 = Helpers.Create <Kingmaker.UnitLogic.FactLogic.AddSpecialSpellList>();
                        c2.CharacterClass = class_to_add;
                        c2.SpellList      = c_typed.SpellList;
                        feat.AddComponent(c2);
                    }
                }
                else if (c is AddOppositionSchool && spells_type == DomainSpellsType.SpecialList)
                {
                    var c_typed = c as AddOppositionSchool;
                    if (c_typed.CharacterClass != class_to_add)
                    {
                        var c2 = Helpers.Create <AddOppositionSchool>();
                        c2.CharacterClass = class_to_add;
                        c2.School         = c_typed.School;
                        feat.AddComponent(c2);
                    }
                }
                else if (c is Kingmaker.UnitLogic.FactLogic.AddFacts)
                {
                    var c_typed = (Kingmaker.UnitLogic.FactLogic.AddFacts)c;
                    foreach (var f in c_typed.Facts)
                    {
                        addClassToFact(class_to_add, archetypes_to_add, spells_type, f);
                    }
                }
                else if (c is AddAbilityResources)
                {
                    var c_typed = (Kingmaker.Designers.Mechanics.Facts.AddAbilityResources)c;
                    addClassToResource(class_to_add, archetypes_to_add, c_typed.Resource);
                }
                else if (c is FactSinglify)
                {
                    var c_typed = c as FactSinglify;
                    foreach (var f in c_typed.NewFacts)
                    {
                        addClassToFact(class_to_add, archetypes_to_add, spells_type, f);
                    }
                }
                else if (c is ReplaceCasterLevelOfAbility)
                {
                    var c_typed = c as ReplaceCasterLevelOfAbility;

                    c_typed.AdditionalClasses = c_typed.AdditionalClasses.AddToArray(class_to_add);
                    c_typed.Archetypes        = c_typed.Archetypes.AddToArray(archetypes_to_add);
                }
                else if (c is BindAbilitiesToClass)
                {
                    var c_typed = c as BindAbilitiesToClass;

                    c_typed.AdditionalClasses = c_typed.AdditionalClasses.AddToArray(class_to_add);
                    c_typed.Archetypes        = c_typed.Archetypes.AddToArray(archetypes_to_add);
                }
                else if (c is ContextRankConfig)
                {
                    addClassToContextRankConfig(class_to_add, archetypes_to_add, c as ContextRankConfig, feat.name);
                }
                else if (c is IntenseSpells)
                {
                    feat.AddComponent(Helpers.Create <NewMechanics.IntenseSpellsForClasses>(i => i.classes = new BlueprintCharacterClass[] { class_to_add, (c as IntenseSpells).Wizard }));
                    feat.RemoveComponent(c);
                }
                else if (c is NewMechanics.IntenseSpellsForClasses)
                {
                    var c_typed = c as NewMechanics.IntenseSpellsForClasses;
                    if (!c_typed.classes.Contains(class_to_add))
                    {
                        c_typed.classes = c_typed.classes.AddToArray(class_to_add);
                    }
                }
                else if (c is AddClassLevelToSummonDuration)
                {
                    feat.AddComponent(Helpers.Create <NewMechanics.AddClassesLevelToSummonDuration>(i => i.CharacterClasses = new BlueprintCharacterClass[] { class_to_add, (c as AddClassLevelToSummonDuration).CharacterClass }));
                    feat.RemoveComponent(c);
                }
                else if (c is NewMechanics.AddClassesLevelToSummonDuration)
                {
                    var c_typed = c as NewMechanics.AddClassesLevelToSummonDuration;
                    if (!c_typed.CharacterClasses.Contains(class_to_add))
                    {
                        c_typed.CharacterClasses = c_typed.CharacterClasses.AddToArray(class_to_add);
                    }
                }
                else if (c is LearnSpellList && spells_type == DomainSpellsType.NormalList)
                {
                    var spell_list = (c as LearnSpellList)?.SpellList;
                    if (spell_list == null)
                    {
                        continue;
                    }
                    if (archetypes_to_add.Empty())
                    {
                        var learn_spells_fact = Helpers.Create <Kingmaker.UnitLogic.FactLogic.LearnSpellList>();
                        learn_spells_fact.SpellList      = spell_list;
                        learn_spells_fact.CharacterClass = class_to_add;
                        feat.AddComponent(learn_spells_fact);
                    }
                    else
                    {
                        foreach (var ar_type in archetypes_to_add)
                        {
                            var learn_spells_fact = Helpers.Create <Kingmaker.UnitLogic.FactLogic.LearnSpellList>();
                            learn_spells_fact.SpellList      = spell_list;
                            learn_spells_fact.CharacterClass = class_to_add;
                            learn_spells_fact.Archetype      = ar_type;
                            feat.AddComponent(learn_spells_fact);
                        }
                    }
                }
                else if (c is AddKnownSpell && spells_type == DomainSpellsType.NormalList)
                {
                    if (archetypes_to_add.Empty())
                    {
                        var learn_spells_fact = Helpers.Create <AddKnownSpell>();
                        learn_spells_fact.Spell          = (c as AddKnownSpell).Spell;
                        learn_spells_fact.SpellLevel     = (c as AddKnownSpell).SpellLevel;
                        learn_spells_fact.CharacterClass = class_to_add;
                        feat.AddComponent(learn_spells_fact);
                    }
                    else
                    {
                        foreach (var ar_type in archetypes_to_add)
                        {
                            var learn_spells_fact = Helpers.Create <AddKnownSpell>();
                            learn_spells_fact.Spell          = (c as AddKnownSpell).Spell;
                            learn_spells_fact.SpellLevel     = (c as AddKnownSpell).SpellLevel;
                            learn_spells_fact.CharacterClass = class_to_add;
                            learn_spells_fact.Archetype      = ar_type;
                            feat.AddComponent(learn_spells_fact);
                        }
                    }
                }
            }
        }
Esempio n. 5
0
        public static void addClassToProgression(BlueprintCharacterClass class_to_add, BlueprintArchetype[] archetypes_to_add, DomainSpellsType spells_type, BlueprintProgression progression, BlueprintCharacterClass class_to_check)
        {
            if (progression.Classes.Contains(class_to_check))
            {
                progression.Classes = progression.Classes.AddToArray(class_to_add).Distinct().ToArray();


                progression.Archetypes = progression.Archetypes.AddToArray(archetypes_to_add).Distinct().ToArray();
            }

            foreach (var entry in progression.LevelEntries)
            {
                foreach (var feat in entry.Features)
                {
                    addClassToFact(class_to_add, archetypes_to_add, spells_type, feat, class_to_check);
                }
            }

            addClassToFeat(class_to_add, archetypes_to_add, spells_type, progression, class_to_check);
        }
 static void addClassToFact(BlueprintCharacterClass class_to_add, BlueprintArchetype[] archetypes_to_add, DomainSpellsType spells_type, BlueprintUnitFact f)
 {
     if (f is BlueprintAbility)
     {
         addClassToAbility(class_to_add, archetypes_to_add, (f as BlueprintAbility));
     }
     else if (f is BlueprintActivatableAbility)
     {
         addClassToBuff(class_to_add, archetypes_to_add, (f as BlueprintActivatableAbility).Buff);
     }
     else if (f is BlueprintFeatureSelection)
     {
         foreach (var af in (f as BlueprintFeatureSelection).AllFeatures)
         {
             addClassToFact(class_to_add, archetypes_to_add, spells_type, af);
         }
     }
     else if (f is BlueprintProgression)
     {
         addClassToProgression(class_to_add, archetypes_to_add, spells_type, (f as BlueprintProgression));
     }
     else if (f is BlueprintFeature)
     {
         addClassToFeat(class_to_add, archetypes_to_add, spells_type, (f as BlueprintFeatureBase));
     }
 }