示例#1
0
        static private void FixSpecialComps()
        {
            //arcane 9, new arcane selection, wants a variant for blood arcanist
            BlueprintFeatureSelection arcane9_select = library.Get <BlueprintFeatureSelection>("20a2435574bdd7f4e947f405df2b25ce");
            BlueprintFeature          arcane9_scion  = library.Get <BlueprintFeature>("c66e61dea38f3d8479a54eabec20ac99");
            BlueprintFeature          arcane9_ba     = library.CopyAndAdd <BlueprintFeature>(
                arcane9_scion,
                "BloodlineArcaneNewArcanaFeatureArcanist",
                "b0a5863f046005d408d53f05894a6c3a"//MD5-32[ArcanistClass.Archetype.BloodArcanist.Arcane9.Feat]
                );

            arcane9_ba.RemoveComponent(arcane9_ba.GetComponent <LearnSpellParametrized>());
            arcane9_ba.RemoveComponent(arcane9_ba.GetComponent <PrerequisiteArchetypeLevel>());
            arcane9_ba.AddComponent(Helpers.Create <LearnSpellParametrized>(a => {
                a.SpellcasterClass = ArcanistClass.arcanist;
                a.SpellList        = library.Get <BlueprintSpellList>("ba0401fdeb4062f40a7aa95b6f07fe89");//wizard spelllist
            }));
            arcane9_ba.AddComponent(Helpers.Create <PrerequisiteArchetypeLevel>(a => {
                a.Archetype      = archetype;
                a.CharacterClass = ArcanistClass.arcanist;
                a.Level          = 1;
            }));
            HelpersNeu.Add(ref arcane9_select.AllFeatures, arcane9_ba);
            HelpersNeu.Add(ref arcane9_select.Features, arcane9_ba);
        }
        public static bool WieldsWeaponFromFighterGroup(UnitDescriptor owner, BlueprintFeature weaponTraining)
        {
            WeaponGroupAttackBonus weaponGroupAttackBonus = weaponTraining.GetComponent <WeaponGroupAttackBonus>();

            if (weaponGroupAttackBonus != null)
            {
                return((owner.Body.PrimaryHand.MaybeWeapon != null && owner.Body.PrimaryHand.MaybeWeapon.Blueprint.FighterGroup == weaponGroupAttackBonus.WeaponGroup) ||
                       (owner.Body.SecondaryHand.MaybeWeapon != null && owner.Body.SecondaryHand.MaybeWeapon.Blueprint.FighterGroup == weaponGroupAttackBonus.WeaponGroup));
            }

            WeaponParametersAttackBonus weaponParametersAttackBonus = weaponTraining.GetComponent <WeaponParametersAttackBonus>();

            if (weaponParametersAttackBonus != null)
            {
                return(weaponParametersAttackBonus.OnlyTwoHanded && owner.Body.PrimaryHand.MaybeWeapon != null && owner.Body.PrimaryHand.MaybeWeapon.Blueprint.IsTwoHanded);
            }

            return(false);
        }
示例#3
0
        static void addToImprovedChannel(ChannelEntry c)
        {
            if (improved_channel == null)
            {
                return;
            }
            var prereq = improved_channel.GetComponent <PrerequisiteFeaturesFromList>();

            if (!prereq.Features.Contains(c.parent_feature))
            {
                prereq.Features = prereq.Features.AddToArray(c.parent_feature);
            }

            var abilities = improved_channel.GetComponent <NewMechanics.IncreaseSpecifiedSpellsDC>();

            if (!abilities.spells.Contains(c.ability))
            {
                abilities.spells = abilities.spells.AddToArray(c.ability);
            }
        }
        static void createDeceptiveKi()
        {
            deceptive_ki = library.CopyAndAdd <BlueprintFeature>("e9590244effb4be4f830b1e3fffced13", "DeceptiveKiFeature", "");
            deceptive_ki.RemoveComponents <AddFacts>();

            var resource = deceptive_ki.GetComponent <AddAbilityResources>().Resource;

            var ki_feint = library.CopyAndAdd(NewFeats.improved_feint_ability, "KiFeintAbility", "");

            ki_feint.SetNameDescriptionIcon("Ki Feint",
                                            "A sage counselor can spend 1 ki point while performing a flurry of blows to feint an opponent as a swift action, but he can’t spend 1 ki point to make an additional attack when making a flurry of blows.",
                                            LoadIcons.Image2Sprite.Create(@"FeatIcons/FeintingFlurry.png"));
            ki_feint.ActionType = CommandType.Swift;
            ki_feint.AddComponent(resource.CreateResourceLogic());



            var deceptive_ki_buff = Helpers.CreateBuff("DeceptiveKiBuff",
                                                       "Deceptive Ki",
                                                       "At 3rd level, the sage counselor can spend 1 point from his ki pool as a swift action to give himself a +4 insight bonus on his next Bluff check.",
                                                       "",
                                                       Helpers.GetIcon("b3da3fbee6a751d4197e446c7e852bcb"), //true seeing
                                                       null,
                                                       Helpers.CreateAddStatBonus(StatType.CheckBluff, 4, ModifierDescriptor.Insight)
                                                       );

            deceptive_ki_buff.AddComponents(Helpers.Create <AddInitiatorSkillRollTrigger>(a => { a.Skill = StatType.CheckBluff; a.Action = Helpers.CreateActionList(Common.createContextActionRemoveBuff(deceptive_ki_buff)); }),
                                            Helpers.Create <AddInitiatorPartySkillRollTrigger>(a => { a.Skill = StatType.CheckBluff; a.Action = Helpers.CreateActionList(Common.createContextActionRemoveBuff(deceptive_ki_buff)); })
                                            );

            var ability = Helpers.CreateAbility("DeceptiveKiAbility",
                                                deceptive_ki_buff.Name,
                                                deceptive_ki_buff.Description,
                                                "",
                                                deceptive_ki_buff.Icon,
                                                AbilityType.Supernatural,
                                                CommandType.Swift,
                                                AbilityRange.Personal,
                                                "",
                                                "",
                                                Helpers.CreateRunActions(Common.createContextActionApplyBuff(deceptive_ki_buff, Helpers.CreateContextDuration(), is_permanent: true, dispellable: false)),
                                                resource.CreateResourceLogic()
                                                );

            ability.setMiscAbilityParametersSelfOnly();

            deceptive_ki.AddComponents(Helpers.CreateAddFacts(ki_feint, ability));
            deceptive_ki.SetNameDescription("Deceptive Ki",
                                            "A sage counselor can spend 1 ki point while performing a flurry of blows to feint an opponent as a swift action, but he can’t spend 1 ki point to make an additional attack when making a flurry of blows.\n"
                                            + "In addition, the sage counselor can spend 1 point from his ki pool as a swift action to give himself a +4 insight bonus on his next Bluff check. The sage counselor does not gain the ability to spend ki to increase his speed by 20 feet for 1 round."
                                            );
        }
示例#5
0
 static private void FixOppositionSchoolFeats()
 {
     //fix opposition school feats so that they can function on arcanist class
     foreach (string featId in config.SchoolOppositionFeatureIds)
     {
         BlueprintFeature feat   = library.Get <BlueprintFeature>(featId);
         SpellSchool      school = feat.GetComponent <AddOppositionSchool>().School;
         feat.AddComponent(Helpers.Create <AddOppositionSchool>(a => {
             a.CharacterClass = ArcanistClass.arcanist;
             a.School         = school;
         }));
     }
 }
        private void CheckWeapons()
        {
            WeaponGroupAttackBonus weaponGroupAttackBonus = WeaponTraining.GetComponent <WeaponGroupAttackBonus>();

            if (base.Owner.Body.SecondaryHand.MaybeWeapon != null &&
                AdvancedWeaponTraining._weaponCategoryToWeaponTraining[base.Owner.Body.SecondaryHand.MaybeWeapon.Blueprint.Category] == weaponGroupAttackBonus.WeaponGroup &&
                !base.Owner.Body.SecondaryHand.MaybeWeapon.Blueprint.IsLight)
            {
                Activate();
            }
            else
            {
                Deactivate();
            }
        }
        private static void CreateGuidedHandFeat()
        {
            BlueprintFeature selectiveChannel = library.Get <BlueprintFeature>("fd30c69417b434d47b6b03b9c1f568ff");

            List <BlueprintFeature> guidedHandFeatures = new List <BlueprintFeature>();

            foreach (BlueprintFeature feature in Resources.FindObjectsOfTypeAll <BlueprintFeature>())
            {
                if (feature.Groups.Contains(FeatureGroup.Deities))
                {
                    AddFeatureOnClassLevel levelUpProficiencyFeature = feature.GetComponent <AddFeatureOnClassLevel>();
                    if (levelUpProficiencyFeature != null)
                    {
                        BlueprintFeature proficiencyFeature = levelUpProficiencyFeature.Feature;
                        WeaponCategory   category;
                        if (proficiencyFeature.AssetGuid == "7812ad3672a4b9a4fb894ea402095167")
                        {
                            category = WeaponCategory.UnarmedStrike;
                        }
                        else
                        {
                            AddProficiencies addedProficiency = proficiencyFeature.GetComponent <AddProficiencies>();
                            category = addedProficiency.WeaponProficiencies[0];
                        }

                        guidedHandFeatures.Add(Helpers.CreateFeature(
                                                   "GuidedHand" + feature.AssetGuid,
                                                   "Guided Hand (" + feature.name + ")",
                                                   "With your deity’s favored weapon, you can use your Wisdom modifier instead of your Strength or Dexterity modifier on attack rolls.",
                                                   Helpers.getGuid("GuidedHand" + feature.AssetGuid),
                                                   feature.Icon,
                                                   FeatureGroup.Feat,
                                                   feature.PrerequisiteFeature(),
                                                   Helpers.Create <PrerequisiteProficiency>(x => x.WeaponProficiencies = new WeaponCategory[] { category }),
                                                   selectiveChannel.PrerequisiteFeature(),
                                                   Helpers.Create <ReplaceAttackStatForWeaponCategoryLogic>(x =>
                        {
                            x.StatType       = StatType.Wisdom;
                            x.WeaponCategory = category;
                        })
                                                   ));
                    }
                }
            }

            library.AddFeats(guidedHandFeatures.ToArray());
        }
示例#8
0
        static void createHuntingGround()
        {
            var favored_terrain = library.Get <BlueprintFeatureSelection>("a6ea422d7308c0d428a541562faedefd");

            hunting_ground = Helpers.CreateFeature("HintingGroundBloodHunterFeature",
                                                   "Hunting Ground",
                                                   "Blood Hunter treats all terrains from ranger favored terrain list as his favored terrains. The blood hunter gains a +2 bonus on initiative checks and Lore (Nature), Perception, and Stealth skill checks when he is in his favored terrain.  The bonuses increase by 2 at 8th level and every 5 levels thereafter.",
                                                   "",
                                                   LoadIcons.Image2Sprite.Create(@"AbilityIcons/HuntingGround.png"),
                                                   FeatureGroup.None,
                                                   Helpers.Create <FavoredTerrain>(f => f.Settings = new LootSetting[0])
                                                   );
            hunting_ground.ReapplyOnLevelUp = true;
            hunting_ground.Ranks            = 10;
            foreach (var ft in favored_terrain.AllFeatures)
            {
                var comp = hunting_ground.GetComponent <FavoredTerrain>();
                comp.Settings = comp.Settings.AddToArray(ft.GetComponent <FavoredTerrain>().Settings);
            }
        }
示例#9
0
 static void addToWitchImprovedChannelHexScaling(ChannelEntry entry)
 {
     if (witch_channel_negative == null)
     {
         return;
     }
     if (!entry.scalesWithClass(Witch.witch_class))
     {
         return;
     }
     if ((entry.channel_type & ChannelType.Negative) != ChannelType.None)
     {
         var comp = witch_channel_negative.GetComponent <NewMechanics.ContextIncreaseCasterLevelForSelectedSpells>();
         comp.spells = comp.spells.AddToArray(entry.ability);
     }
     if ((entry.channel_type & ChannelType.Positive) != ChannelType.None)
     {
         var comp = witch_channel_positive.GetComponent <NewMechanics.ContextIncreaseCasterLevelForSelectedSpells>();
         comp.spells = comp.spells.AddToArray(entry.ability);
     }
 }
示例#10
0
        private void RemoveMetamagicFeatInSpellSlots(BlueprintFeature metafeatOld)
        {
            Metamagic          metaOld        = metafeatOld.GetComponent <AddMetamagicFeat>().Metamagic;
            List <AbilityData> spellsToRemove = new List <AbilityData>();
            List <SpellSlot>   slotsToForget  = new List <SpellSlot>();
            var unit = base.Owner;

            foreach (Spellbook spellbook in unit.Spellbooks)
            {
                int maxSplLevel = spellbook.MaxSpellLevel;
                for (int i = 1; i <= maxSplLevel; i++)
                {
                    foreach (AbilityData spell in spellbook.GetCustomSpells(i))
                    {
                        if (spell.HasMetamagic(metaOld))
                        {
                            spellsToRemove.Add(spell);
                        }
                    }
                    foreach (SpellSlot slot in spellbook.GetMemorizedSpellSlots(i))
                    {
                        if (slot.Spell != null && !slot.IsOpposition)
                        {
                            if (slot.Spell.HasMetamagic(metaOld))
                            {
                                slotsToForget.Add(slot);
                            }
                        }
                    }
                }
                foreach (SpellSlot slot in slotsToForget)
                {
                    spellbook.ForgetMemorized(slot);
                }
                foreach (AbilityData spell in spellsToRemove)
                {
                    spellbook.RemoveCustomSpell(spell);
                }
            }
        }
示例#11
0
        static void addToQuickChannel(BlueprintAbility channel, BlueprintFeature parent_feature, ChannelType channel_type)
        {
            if (quick_channel == null)
            {
                return;
            }

            var features_from_list = quick_channel.GetComponent <PrerequisiteFeaturesFromList>();

            if (features_from_list == null)
            {
                features_from_list = Helpers.PrerequisiteFeaturesFromList(parent_feature);
                quick_channel.AddComponent(features_from_list);
            }

            if (!features_from_list.Features.Contains(parent_feature))
            {
                features_from_list.Features = features_from_list.Features.AddToArray(parent_feature);
            }


            var quicken_ability = library.CopyAndAdd <BlueprintAbility>(channel.AssetGuid, "Quick" + channel.name, channel.AssetGuid, "e936d73a1dfe42efb1765b980c80e113");

            quicken_ability.ActionType = Kingmaker.UnitLogic.Commands.Base.UnitCommand.CommandType.Move;
            quicken_ability.SetName(quicken_ability.Name + $" ({quick_channel.Name})");
            var resource_logic = quicken_ability.GetComponent <AbilityResourceLogic>();
            var amount         = resource_logic.Amount;

            quicken_ability.ReplaceComponent <AbilityResourceLogic>(c => { c.Amount = amount * 2; });
            updateItemsForQuick(channel, quicken_ability);

            var quicken_feature = Common.AbilityToFeature(quicken_ability, guid: Helpers.MergeIds(quicken_ability.AssetGuid, parent_feature.AssetGuid));

            quick_channel.AddComponent(Common.createAddFeatureIfHasFact(parent_feature, quicken_feature));
            parent_feature.AddComponent(Common.createAddFeatureIfHasFact(quick_channel, quicken_feature));

            storeChannel(quicken_ability, parent_feature, channel_type);
        }
示例#12
0
        static BlueprintFeature CreateMagusArcanaMetamagic(BlueprintFeature metamagicFeat, int requiredLevel)
        {
            var metamagic = metamagicFeat.GetComponent <AddMetamagicFeat>().Metamagic;
            var name      = metamagic.ToString();

            name += name.EndsWith("e") ? "d" : "ed";
            var feat = Helpers.CreateFeature($"Magus{name}Magic", $"{name} Magic",
                                             $"The magus can cast one spell per day as if it were modified by the {metamagic} Spell feat. " +
                                             (metamagic == Metamagic.Quicken
                    ? "This does not increase the level of the spell."
                    : "This does not increase the casting time or the level of the spell."),
                                             Helpers.MergeIds(metamagicFeat.AssetGuid, "65768d69b6b84954b3d6a1d1dc265cf8"),
                                             metamagicFeat.Icon,
                                             FeatureGroup.MagusArcana);

            var resource = Helpers.CreateAbilityResource($"{feat.name}Resource", "", "",
                                                         Helpers.MergeIds(metamagicFeat.AssetGuid, "d7183ba98b094f8295181c9946319773"), null);

            resource.SetFixedResource(1);

            var buff = Helpers.CreateBuff($"{feat.name}Buff", feat.Name, feat.Description,
                                          Helpers.MergeIds(metamagicFeat.AssetGuid, "e1b0f16092b7411aa7789cc598e232da"), feat.Icon, null,
                                          Helpers.Create <MetamagicOnNextSpellFixed>(m => m.Metamagic = metamagic));

            var ability = Helpers.CreateAbility($"{feat.name}Ability", feat.Name, feat.Description,
                                                Helpers.MergeIds(metamagicFeat.AssetGuid, "2c79573d82754a178b7767d9c51bd247"), feat.Icon,
                                                AbilityType.Supernatural, CommandType.Free, AbilityRange.Personal, "", "",
                                                resource.CreateResourceLogic(),
                                                Helpers.CreateRunActions(Helpers.CreateApplyBuff(buff,
                                                                                                 Helpers.CreateContextDuration(1), permanent: true, fromSpell: false, dispellable: false, toCaster: true)));

            feat.SetComponents(magus.PrerequisiteClassLevel(requiredLevel),
                               resource.CreateAddAbilityResource(), ability.CreateAddFact());

            return(feat);
        }
示例#13
0
        static void addToVersatileChanneler(ChannelEntry entry)
        {
            if (versatile_channeler == null)
            {
                return;
            }
            var cleric = library.Get <BlueprintCharacterClass>("67819271767a9dd4fbfd4ae700befea0");

            if (entry.scalesWithClass(cleric))
            {
                if (entry.channel_type.isOf(ChannelType.Positive))
                {
                    var comp = versatile_channeler_positive.GetComponent <NewMechanics.ContextIncreaseCasterLevelForSelectedSpells>();
                    comp.spells = comp.spells.AddToArray(entry.ability);
                }
                else if (entry.channel_type.isOf(ChannelType.Negative))
                {
                    var comp = versatile_channeler_negative.GetComponent <NewMechanics.ContextIncreaseCasterLevelForSelectedSpells>();
                    comp.spells = comp.spells.AddToArray(entry.ability);
                }
            }

            if (entry.scalesWithClass(Warpriest.warpriest_class))
            {
                if (entry.channel_type.isOf(ChannelType.Positive))
                {
                    var comp = versatile_channeler_positive_warpriest.GetComponent <NewMechanics.ContextIncreaseCasterLevelForSelectedSpells>();
                    comp.spells = comp.spells.AddToArray(entry.ability);
                }
                else if (entry.channel_type.isOf(ChannelType.Negative))
                {
                    var comp = versatile_channeler_negative_warpriest.GetComponent <NewMechanics.ContextIncreaseCasterLevelForSelectedSpells>();
                    comp.spells = comp.spells.AddToArray(entry.ability);
                }
            }
        }
示例#14
0
        static void createBlessedHunterFeats()
        {
            blessed_hunter = Helpers.CreateFeature("BlessedHunterBloodHunterFeat",
                                                   "Blessed Hunter",
                                                   "While in his favored terrain, blood hunter gains +1 bonus on damage rolls and saving throws.",
                                                   "",
                                                   null,
                                                   FeatureGroup.None,
                                                   Helpers.Create <FavoredEnemyMechanics.BlessedHunterTerrain>(b => b.Settings = hunting_ground.GetComponent <FavoredTerrain>().Settings)
                                                   );


            blessed_hunter_stride = library.CopyAndAdd <BlueprintFeature>("11f4072ea766a5840a46e6660894527d", "BlessedHunterStrideFeature", "");
            blessed_hunter_stride.SetNameDescription("Blessed Hunter's Stride",
                                                     "Blood hunter's speed increases by 10 feet while he is in his favored terrain, and he ignores difficult terrain effects.");
            blessed_hunter_stride.AddComponent(Helpers.CreateAddStatBonus(StatType.Speed, 10, ModifierDescriptor.UntypedStackable));
            var animal_focus_engine = new AnimalFocusEngine();

            animal_focus_engine.initialize(new BlueprintCharacterClass[] { archetype.GetParentClass() }, archetype, 0, "BloodHunter");

            var animal_focus = animal_focus_engine.createAnimalFocus();

            animal_focus.HideInCharacterSheetAndLevelUp = true;
            blessed_hunters_focus = Helpers.CreateFeature("BlessedHunterFocusBloodHunterFeature",
                                                          "Blessed Hunter's Focus",
                                                          "At 13th level, while in his favored terrain, blood hunter gains the benefits of the hunter’s animal focus class feature, with an effective hunter level equal to his blood hunter level. If blood hunter formed a bond with animal companion, he can also apply animal focus to it.",
                                                          "",
                                                          animal_focus.Icon,
                                                          FeatureGroup.None,
                                                          Helpers.CreateAddFact(animal_focus),
                                                          Common.createAddFeatToAnimalCompanion(animal_focus)
                                                          );
            var ranger_ac_selection = library.Get <BlueprintFeatureSelection>("ee63330662126374e8785cc901941ac7");
            var planar_focus        = animal_focus_engine.createPlanarFocus("Blood Hunter", ranger_ac_selection);

            planar_focus.AddComponents(Common.createPrerequisiteArchetypeLevel(archetype.GetParentClass(), archetype, 13));
        }
        static bool Prefix(ContextRankConfig __instance, MechanicsContext context, ContextRankBaseValueType ___m_BaseValueType, bool ___m_ExceptClasses, StatType ___m_Stat,
                           BlueprintFeature ___m_Feature, BlueprintCharacterClass[] ___m_Class, BlueprintArchetype ___Archetype, ref int __result)
        {
            if (___m_BaseValueType == ContextRankBaseValueTypeExtender.MasterClassLevel.ToContextRankBaseValueType() ||
                ___m_BaseValueType == ContextRankBaseValueTypeExtender.MasterMaxClassLevelWithArchetype.ToContextRankBaseValueType())
            {
                int rankBonus1 = context.Params.RankBonus;
                var caster     = context.MaybeCaster;

                __result = rankBonus1 + getMasterRank(caster.Descriptor, __instance);
                return(false);
            }
            else if (___m_BaseValueType == ContextRankBaseValueTypeExtender.MasterFeatureRank.ToContextRankBaseValueType())
            {
                if (context.MaybeCaster.Descriptor.IsPet)
                {
                    __result = context.MaybeCaster.Descriptor.Master.Value.Descriptor.Progression.Features.GetRank(___m_Feature);
                }
                else
                {
                    __result = context.MaybeCaster.Descriptor.Progression.Features.GetRank(___m_Feature);
                }
                return(false);
            }
            else if (___m_BaseValueType == ContextRankBaseValueTypeExtender.ClassLevelPlusStatValue.ToContextRankBaseValueType())
            {
                int rankBonus1 = context.Params.RankBonus;
                foreach (Kingmaker.UnitLogic.ClassData classData in context.MaybeCaster.Descriptor.Progression.Classes)
                {
                    if (___m_ExceptClasses && !((IList <BlueprintCharacterClass>)___m_Class).HasItem <BlueprintCharacterClass>(classData.CharacterClass) || !___m_ExceptClasses && ((IList <BlueprintCharacterClass>)___m_Class).HasItem <BlueprintCharacterClass>(classData.CharacterClass))
                    {
                        rankBonus1 += classData.Level;
                    }
                }
                int?bonus = context.MaybeCaster.Descriptor.Stats.GetStat <ModifiableValueAttributeStat>(___m_Stat)?.Bonus;
                rankBonus1 = !bonus.HasValue ? rankBonus1 : rankBonus1 + bonus.Value;
                __result   = rankBonus1;
                return(false);
            }
            else if (___m_BaseValueType == ContextRankBaseValueTypeExtender.SummClassLevelWithArchetypes.ToContextRankBaseValueType())
            {
                __result = 0;
                var archetypes_list = ___m_Feature.GetComponent <ContextRankConfigArchetypeList>().archetypes;
                if (___Archetype != null)
                {
                    archetypes_list = archetypes_list.AddToArray(___Archetype);
                }
                foreach (var c in context.MaybeCaster.Descriptor.Progression.Classes)
                {
                    if (!___m_Class.Contains(c.CharacterClass))
                    {
                        continue;
                    }
                    var class_archetypes = archetypes_list.Where(a => a.GetParentClass() == c.CharacterClass).ToArray();
                    if (class_archetypes.Empty())
                    {
                        __result = Math.Max(c.Level, __result);
                    }
                    else
                    {
                        foreach (var a in c.Archetypes)
                        {
                            if (class_archetypes.Contains(a))
                            {
                                __result = Math.Max(c.Level, __result);
                                break;
                            }
                        }
                    }
                }
                return(false);
            }
            else if (___m_BaseValueType == ContextRankBaseValueTypeExtender.MaxClassLevelWithArchetypes.ToContextRankBaseValueType())
            {
                __result = 0;
                var archetypes_list = ___m_Feature.GetComponent <ContextRankConfigArchetypeList>().archetypes;
                if (___Archetype != null)
                {
                    archetypes_list = archetypes_list.AddToArray(___Archetype);
                }
                foreach (var c in context.MaybeCaster.Descriptor.Progression.Classes)
                {
                    if (!___m_Class.Contains(c.CharacterClass))
                    {
                        continue;
                    }
                    var class_archetypes = archetypes_list.Where(a => a.GetParentClass() == c.CharacterClass).ToArray();
                    if (class_archetypes.Empty())
                    {
                        __result = Math.Max(c.Level, __result);
                    }
                    else
                    {
                        foreach (var a in c.Archetypes)
                        {
                            if (class_archetypes.Contains(a))
                            {
                                __result = Math.Max(c.Level, __result);
                                break;
                            }
                        }
                    }
                }
                return(false);
            }
            else
            {
                return(true);
            }
        }
        private static String getWeaponTrainingName(BlueprintFeature weaponTraining, bool removeBlanks = false)
        {
            String toReturn = "";
            WeaponGroupAttackBonus weaponGroupAttackBonus = weaponTraining.GetComponent <WeaponGroupAttackBonus>();

            if (weaponGroupAttackBonus != null)
            {
                switch (weaponGroupAttackBonus.WeaponGroup)
                {
                case WeaponFighterGroup.Axes:
                    toReturn = "Axes";
                    break;

                case WeaponFighterGroup.BladesHeavy:
                    toReturn = "Blades, Heavy";
                    break;

                case WeaponFighterGroup.BladesLight:
                    toReturn = "Blades, Light";
                    break;

                case WeaponFighterGroup.Bows:
                    toReturn = "Bows";
                    break;

                case WeaponFighterGroup.Close:
                    toReturn = "Close";
                    break;

                case WeaponFighterGroup.Crossbows:
                    toReturn = "Crossbows";
                    break;

                case WeaponFighterGroup.Double:
                    toReturn = "Double";
                    break;

                case WeaponFighterGroup.Flails:
                    toReturn = "Flails";
                    break;

                case WeaponFighterGroup.Hammers:
                    toReturn = "Hammers";
                    break;

                case WeaponFighterGroup.Monk:
                    toReturn = "Monk";
                    break;

                case WeaponFighterGroup.Natural:
                    toReturn = "Natural";
                    break;

                case WeaponFighterGroup.None:
                    toReturn = "Unknown";
                    break;

                case WeaponFighterGroup.Polearms:
                    toReturn = "Polearms";
                    break;

                case WeaponFighterGroup.Spears:
                    toReturn = "Spears";
                    break;

                case WeaponFighterGroup.Thrown:
                    toReturn = "Thrown";
                    break;
                }
            }
            else
            {
                WeaponParametersAttackBonus weaponParametersAttackBonus = weaponTraining.GetComponent <WeaponParametersAttackBonus>();
                if (weaponParametersAttackBonus.OnlyTwoHanded)
                {
                    toReturn = "Two-Handed";
                }
            }

            if (removeBlanks)
            {
                toReturn = toReturn.Trim();
            }

            return(toReturn);
        }
        static void createFavoredTerrain()
        {
            favored_terrain = library.CopyAndAdd <BlueprintFeature>("c657b9b7ebab46541b5992cfa7a0e1ef", "HinterlanderFavoredTerrain", "");
            favored_terrain.SetDescription("The hinterlander gains a +2 bonus on initiative checks and Lore (Nature), Perception, and Stealth skill checks when he is in plains.\nAt 9th level these bonuses increase to +4.");

            var eagle_splendor   = library.Get <BlueprintAbility>("446f7bf201dc1934f96ac0a26e324803");
            var choosen_kin_buff = Helpers.CreateBuff("HinterlanderChoosenKinBuff",
                                                      "Choosen Kin",
                                                      "At 4th level, hinterlander provides half of her favored terrain bonus to all her allies within 30 ft. At 7th level, the range increases to 60 feet.",
                                                      "",
                                                      eagle_splendor.Icon,
                                                      null,
                                                      Helpers.Create <NewMechanics.FavoredTerrainBonus>(f =>
            {
                f.Settings = favored_terrain.GetComponent <FavoredTerrain>().Settings;
                f.Value    = Helpers.CreateContextValue(AbilityRankType.StatBonus);
            }
                                                                                                        ),
                                                      Helpers.CreateContextRankConfig(baseValueType: ContextRankBaseValueType.ClassLevel, classes: getHinterlanderArray(),
                                                                                      progression: ContextRankProgression.OnePlusDivStep, stepLevel: 9, type: AbilityRankType.StatBonus)
                                                      );

            int[] ranges = new int[] { 30, 60 };
            BlueprintFeature[] choosen_kin_features = new BlueprintFeature[ranges.Length];

            for (int i = 0; i < ranges.Length; i++)
            {
                var area = library.CopyAndAdd <BlueprintAbilityAreaEffect>("7ced0efa297bd5142ab749f6e33b112b", $"HinterlanderChoosenKin{i+1}Area", "");
                area.Size = ranges[i].Feet();
                area.ReplaceComponent <AbilityAreaEffectBuff>(a =>
                {
                    a.Buff      = choosen_kin_buff;
                    a.Condition = Helpers.CreateConditionsCheckerAnd(Helpers.Create <ContextConditionIsAlly>(), Common.createContextConditionIsCaster(not: true));
                }
                                                              );

                var effect_buff = Helpers.CreateBuff($"HinterlanderChoosenKinEffect{i + 1}Buff",
                                                     "",
                                                     "",
                                                     "",
                                                     null,
                                                     null,
                                                     Common.createAddAreaEffect(area)
                                                     );
                effect_buff.SetBuffFlags(BuffFlags.HiddenInUi);

                choosen_kin_features[i] = Helpers.CreateFeature($"HinterlanderChoosenKin{i+1}Feature",
                                                                "",
                                                                "",
                                                                "",
                                                                null,
                                                                FeatureGroup.None,
                                                                Common.createAuraFeatureComponent(effect_buff)
                                                                );
                choosen_kin_features[i].HideInUI = true;
            }


            choosen_kin = Helpers.CreateFeature("HinterlanderChoosenKinFeature",
                                                choosen_kin_buff.Name,
                                                choosen_kin_buff.Description,
                                                "",
                                                choosen_kin_buff.Icon,
                                                FeatureGroup.None,
                                                Helpers.CreateAddFeatureOnClassLevel(choosen_kin_features[0], 7, getHinterlanderArray(), new BlueprintArchetype[0], true),
                                                Helpers.CreateAddFeatureOnClassLevel(choosen_kin_features[1], 7, getHinterlanderArray(), new BlueprintArchetype[0])
                                                );
        }