Esempio n. 1
0
        static void stalwarBuffReplacement(BlueprintActivatableAbility toggle_ability, BlueprintBuff stalwart_toggle_buff)
        {
            var toggle_buff   = toggle_ability.Buff;
            var stalwart_buff = Helpers.CreateBuff("Stalwart" + toggle_buff.name,
                                                   "",
                                                   "",
                                                   "",
                                                   null,
                                                   null,
                                                   toggle_buff.ComponentsArray
                                                   );

            stalwart_buff.SetBuffFlags(BuffFlags.HiddenInUi);

            var ac_component = stalwart_buff.GetComponents <AddStatBonusAbilityValue>().Where(c => c.Stat == StatType.AC).FirstOrDefault();

            if (ac_component != null)
            {//fight defensively
                stalwart_buff.ReplaceComponent(ac_component, Common.createContextPhysicalDR(ac_component.Value));
                //fix for crane wing
                var crane_style_buff        = library.Get <BlueprintBuff>("e8ea7bd10136195478d8a5fc5a44c7da");
                var crane_style_conditional = (crane_style_buff.GetComponent <AddInitiatorAttackWithWeaponTrigger>().Action.Actions[0] as Conditional);

                var has_fight_defensively = crane_style_conditional.ConditionsChecker.Conditions[2] as ContextConditionHasFact;

                crane_style_conditional.ConditionsChecker.Conditions = crane_style_conditional.ConditionsChecker.Conditions.RemoveFromArray(has_fight_defensively);
                var combined_condition = Helpers.CreateConditional(new Condition[] { has_fight_defensively, Helpers.CreateConditionHasFact(stalwart_buff) }, crane_style_conditional.IfTrue.Actions[0]);
                combined_condition.ConditionsChecker.Operation = Operation.Or;
                crane_style_conditional.IfTrue = Helpers.CreateActionList(combined_condition);
            }
            else
            {//combat expertise
                var scaled_dr = Common.createContextPhysicalDR(Helpers.CreateContextValue(AbilityRankType.StatBonus));
                stalwart_buff.ReplaceComponent <AddStatBonus>(scaled_dr);
                stalwart_buff.AddComponent(Helpers.CreateContextRankConfig(baseValueType: ContextRankBaseValueType.BaseAttack, progression: ContextRankProgression.OnePlusDivStep,
                                                                           type: AbilityRankType.StatBonus, stepLevel: 4));
            }

            var improved_stalwart_buff = library.CopyAndAdd <BlueprintBuff>(stalwart_buff.AssetGuid, "ImprovedStalwart" + toggle_buff.name, "");

            improved_stalwart_buff.AddComponent(improved_stalwart_buff.GetComponent <AddDamageResistancePhysical>());

            var new_toggle_buff = library.CopyAndAdd <BlueprintBuff>(toggle_buff.AssetGuid, "Base" + toggle_buff.Name, "");

            toggle_buff.SetBuffFlags(BuffFlags.HiddenInUi);

            var context_action = Helpers.CreateConditional(Common.createContextConditionCasterHasFact(stalwart_toggle_buff),
                                                           Helpers.CreateConditional(Common.createContextConditionCasterHasFact(improved_stalwart),
                                                                                     Common.createContextActionApplyBuff(improved_stalwart_buff, Helpers.CreateContextDuration(),
                                                                                                                         is_child: true, dispellable: false, is_permanent: true),
                                                                                     Common.createContextActionApplyBuff(stalwart_buff, Helpers.CreateContextDuration(),
                                                                                                                         is_child: true, dispellable: false, is_permanent: true)
                                                                                     ),
                                                           Common.createContextActionApplyBuff(toggle_buff, Helpers.CreateContextDuration(),
                                                                                               is_child: true, dispellable: false, is_permanent: true)
                                                           );

            new_toggle_buff.SetComponents(Helpers.CreateAddFactContextActions(context_action));
            toggle_ability.Buff = new_toggle_buff;
        }
            private static void AddQuiver(BlueprintActivatableAbility ability, BlueprintBuff buff, string guid, PhysicalDamageMaterial material)
            {
                var component = ScriptableObject.CreateInstance <AddOutgoingPhysicalDamageProperty>();

                component.AddMaterial = true;
                component.Material    = material;

                var quiverBuff = Object.Instantiate(buff);

                quiverBuff.ComponentsArray = new BlueprintComponent[] { component };
                Main.Accessors.SetBlueprintUnitFactDisplayName(quiverBuff, new L10NString($"craftMagicItems-mundane-{material.ToString().ToLower()}-quiver-name"));
                Main.Accessors.SetBlueprintUnitFactDescription(quiverBuff, new L10NString($"craftMagicItems-mundane-{material.ToString().ToLower()}-quiver-description"));

                var quiverAbility = Object.Instantiate(ability);

                quiverAbility.Buff = quiverBuff;
                Main.Accessors.SetBlueprintUnitFactDisplayName(quiverAbility, new L10NString($"craftMagicItems-mundane-{material.ToString().ToLower()}-quiver-name"));
                Main.Accessors.SetBlueprintUnitFactDescription(quiverAbility, new L10NString($"craftMagicItems-mundane-{material.ToString().ToLower()}-quiver-description"));

                var newGuid = $"{guid}#CraftMagicItems({material.ToString()}QuiverAbility)";

                Main.Accessors.SetBlueprintScriptableObjectAssetGuid(quiverAbility, newGuid);
                ResourcesLibrary.LibraryObject.BlueprintsByAssetId?.Add(newGuid, quiverAbility);
                ResourcesLibrary.LibraryObject.GetAllBlueprints().Add(quiverAbility);
            }
        public UnitCommand.CommandType getCommandType(BlueprintActivatableAbility activatable_ability)
        {
            if (activatable_ability.Group == ActivatableAbilityGroup.None)
            {
                return(activatable_ability.ActivateWithUnitCommandType);
            }

            var ability_entries = entries.Where(e => e.group == activatable_ability.Group).ToList();

            if (ability_entries.Empty())
            {
                return(activatable_ability.ActivateWithUnitCommandType);
            }
            var entry = ability_entries.Find(e => e.group == activatable_ability.Group && e.action == UnitCommand.CommandType.Free);

            if (entry != null)
            {
                return(activatable_ability.ActivateWithUnitCommandType);
            }

            entry = ability_entries.Find(e => e.group == activatable_ability.Group && e.action == UnitCommand.CommandType.Swift);
            if (entry != null)
            {
                return(entry.action);
            }

            entry = ability_entries.Find(e => e.group == activatable_ability.Group && e.action == UnitCommand.CommandType.Move);
            if (entry != null)
            {
                return(entry.action);
            }

            return(UnitCommand.CommandType.Standard);
        }
Esempio n. 4
0
        public static void Load()
        {
            var library = Main.library;

            archaeologistLuck = library.Get <BlueprintActivatableAbility>("12dc796147c42e04487fcad3aaa40cea");

            archaeologistLuck.Group = ActivatableAbilityGroup.BardicPerformance;
        }
Esempio n. 5
0
            private static void AddQuiver(BlueprintActivatableAbility ability, BlueprintBuff buff, string guid, PhysicalDamageMaterial material)
            {
#if PATCH21_BETA
                var component = SerializedScriptableObject.CreateInstance <AddOutgoingPhysicalDamageProperty>();
#else
                var component = ScriptableObject.CreateInstance <AddOutgoingPhysicalDamageProperty>();
#endif
                component.AddMaterial = true;
                component.Material    = material;

#if PATCH21_BETA
                var quiverBuff = (BlueprintBuff)SerializedScriptableObject.Instantiate(buff);
#else
                var quiverBuff = Object.Instantiate(buff);
#endif
                quiverBuff.ComponentsArray = new BlueprintComponent[] { component };
                Main.Accessors.SetBlueprintUnitFactDisplayName(quiverBuff) = new L10NString($"craftMagicItems-mundane-{material.ToString().ToLower()}-quiver-name");
                Main.Accessors.SetBlueprintUnitFactDescription(quiverBuff) = new L10NString($"craftMagicItems-mundane-{material.ToString().ToLower()}-quiver-description");
#if PATCH21_BETA
                quiverBuff.OnEnable();
                foreach (var c in quiverBuff.ComponentsArray)
                {
                    c.OnEnable();
                }
#endif

                var buffGuid = $"{guid}#CraftMagicItems({material.ToString()}QuiverBuff)";

                Main.Accessors.SetBlueprintScriptableObjectAssetGuid(quiverBuff) = buffGuid;
                ResourcesLibrary.LibraryObject.BlueprintsByAssetId?.Add(buffGuid, quiverBuff);
                ResourcesLibrary.LibraryObject.GetAllBlueprints()?.Add(quiverBuff);

#if PATCH21_BETA
                var quiverAbility = (BlueprintActivatableAbility)SerializedScriptableObject.Instantiate(ability);
#else
                var quiverAbility = Object.Instantiate(ability);
#endif
                quiverAbility.Buff = quiverBuff;
                Main.Accessors.SetBlueprintUnitFactDisplayName(quiverAbility) = new L10NString($"craftMagicItems-mundane-{material.ToString().ToLower()}-quiver-name");
                Main.Accessors.SetBlueprintUnitFactDescription(quiverAbility) = new L10NString($"craftMagicItems-mundane-{material.ToString().ToLower()}-quiver-description");
#if PATCH21_BETA
                quiverBuff.OnEnable();
                foreach (var c in quiverAbility.ComponentsArray)
                {
                    c.OnEnable();
                }
#endif

                var abilityGuid = $"{guid}#CraftMagicItems({material.ToString()}QuiverAbility)";

                Main.Accessors.SetBlueprintScriptableObjectAssetGuid(quiverAbility) = abilityGuid;
                ResourcesLibrary.LibraryObject.BlueprintsByAssetId?.Add(abilityGuid, quiverAbility);
                ResourcesLibrary.LibraryObject.GetAllBlueprints()?.Add(quiverAbility);
            }
        static BlueprintActivatableAbility[] createSacredBondAbility(string name, string display_name, string description, UnityEngine.Sprite icon, params BlueprintComponent[] components)
        {
            var toggles      = new BlueprintActivatableAbility[6];
            var switch_buffs = new BlueprintBuff[6];

            for (int i = 0; i < 6; i++)
            {
                var buff = Helpers.CreateBuff($"{name}Buff{i + 1}",
                                              $"Divine Bond ({display_name} +{i+1})",
                                              description,
                                              "",
                                              icon,
                                              null,
                                              components[i]
                                              );
                switch_buffs[i] = Helpers.CreateBuff($"{name}SwitchBuff{i + 1}",
                                                     display_name,
                                                     description,
                                                     "",
                                                     icon,
                                                     null
                                                     );
                switch_buffs[i].SetBuffFlags(BuffFlags.HiddenInUi);

                Common.addContextActionApplyBuffOnFactsToActivatedAbilityBuffNoRemove(divine_bond_buff, buff, switch_buffs[i]);

                toggles[i] = Helpers.CreateActivatableAbility($"{name}ToggleAbility{i + 1}",
                                                              buff.Name,
                                                              description,
                                                              "",
                                                              icon,
                                                              switch_buffs[i],
                                                              AbilityActivationType.Immediately,
                                                              CommandType.Free,
                                                              null);
                toggles[i].Group                 = ActivatableAbilityGroup.DivineWeaponProperty;
                toggles[i].WeightInGroup         = i + 1;
                toggles[i].DeactivateImmediately = true;
            }

            for (int i = 0; i < 6; i++)
            {
                for (int j = 0; j < 6; j++)
                {
                    if (j != i)
                    {
                        toggles[i].AddComponent(Helpers.Create <RestrictionHasFact>(r => { r.Feature = switch_buffs[j]; r.Not = true; }));
                    }
                }
            }
            return(toggles);
        }
Esempio n. 7
0
        public UnitCommand.CommandType getCommandType(BlueprintActivatableAbility activatable_ability)
        {
            if (activatable_ability.Group == ActivatableAbilityGroup.None)
            {
                return(activatable_ability.ActivateWithUnitCommandType);
            }

            var entry = entries.Find(e => e.group == activatable_ability.Group);

            if (entry == null)
            {
                return(activatable_ability.ActivateWithUnitCommandType);
            }

            return(entry.action);
        }
        static void createDivineBond()
        {
            var loh_resource = library.Get <BlueprintAbilityResource>("9dedf41d995ff4446a181f143c3db98c");
            var resource     = Helpers.CreateAbilityResource("SacredServantDivineBondResource", "", "", "", null);

            resource.SetIncreasedByLevelStartPlusDivStep(1, 9, 1, 4, 1, 0, 0.0f, new BlueprintCharacterClass[] { archetype.GetParentClass() });
            divine_bond_buff = Helpers.CreateBuff("SacredServantDivineBondBuff",
                                                  "Divine Bond",
                                                  "At 5th level, instead of forming a divine bond with her weapon or a mount, a sacred servant forms a bond with her holy symbol.\n"
                                                  + "At 5th level, the spirit grants one bonus. For every three levels beyond 5th, the spirit grants one additional bonus. These bonuses can be spent in a number of ways to grant the paladin enhanced abilities to channel positive energy and to cast spells.\n"
                                                  + "Each bonus can be used to grant one of the following enhancements:\n"
                                                  + "+1 caster level to any paladin spell cast,\n"
                                                  + "+1 to the DC to halve the damage of channel positive energy when used to harm undead,\n"
                                                  + "+1d6 to channel positive energy,\n"
                                                  + "restore one use/day of lay on hands.\n"
                                                  + "These enhancements stack and can be selected multiple times. The enhancements granted by the spirit are determined when the spirit is called and cannot be changed until the spirit is called again. If the sacred servant increases her number of uses of lay on hands per day in this way, that choice is set for the rest of the day, and once used, these additional uses are not restored (even if the spirit is called again that day). The celestial spirit imparts no enhancements if the holy symbol is held by anyone other than the sacred servant, but resumes giving enhancements if returned to the sacred servant. A sacred servant can use this ability once per day at 5th level, and one additional time per day for every four levels beyond 5th, to a total of four times per day at 17th level.",
                                                  "",
                                                  LoadIcons.Image2Sprite.Create(@"AbilityIcons/Wish.png"),
                                                  null);

            divine_bond_ability = library.CopyAndAdd <BlueprintAbility>("7ff088ab58c69854b82ea95c2b0e35b4", "SacredServantDivineBondAbility", "");
            divine_bond_ability.SetNameDescriptionIcon(divine_bond_buff);
            var apply_buff = Common.createContextActionApplyBuff(divine_bond_buff, Helpers.CreateContextDuration(Helpers.CreateContextValue(AbilityRankType.Default), DurationRate.Minutes), dispellable: false);

            divine_bond_ability.ReplaceComponent <AbilityResourceLogic>(a => a.RequiredResource = resource);
            divine_bond_ability.ReplaceComponent <AbilityEffectRunAction>(a => a.Actions        = Helpers.CreateActionList(apply_buff,
                                                                                                                           Helpers.Create <ResourceMechanics.RestoreResourceAmountEqualToRemainingGroupSize>(r => { r.resource = loh_resource; r.group = ActivatableAbilityGroup.DivineWeaponProperty; }))
                                                                          );
            divine_bond_ability.setMiscAbilityParametersSelfOnly();

            var cl_icon           = Helpers.GetIcon("1bc83efec9f8c4b42a46162d72cbf494"); //burst of glory
            var channel_dice_icon = Helpers.GetIcon("0d657aa811b310e4bbd8586e60156a2d"); //cure critical wounds
            var channel_dc_icon   = Helpers.GetIcon("a9a52760290591844a96d0109e30e04d"); //undeath to death

            var cl_bonuses           = new BlueprintActivatableAbility[6];
            var channel_dc_bonuses   = new BlueprintActivatableAbility[6];
            var channel_dice_bonuses = new BlueprintActivatableAbility[6];



            cl_bonuses = createSacredBondAbility("SacredServantDivineBondCLBonus",
                                                 "Caster Level Bonus",
                                                 divine_bond_buff.Description,
                                                 cl_icon,
                                                 Helpers.Create <NewMechanics.IncreaseAllSpellsCLForSpecificSpellbook>(cl => { cl.spellbook = archetype.GetParentClass().Spellbook; cl.Value = 1; }),
                                                 Helpers.Create <NewMechanics.IncreaseAllSpellsCLForSpecificSpellbook>(cl => { cl.spellbook = archetype.GetParentClass().Spellbook; cl.Value = 2; }),
                                                 Helpers.Create <NewMechanics.IncreaseAllSpellsCLForSpecificSpellbook>(cl => { cl.spellbook = archetype.GetParentClass().Spellbook; cl.Value = 3; }),
                                                 Helpers.Create <NewMechanics.IncreaseAllSpellsCLForSpecificSpellbook>(cl => { cl.spellbook = archetype.GetParentClass().Spellbook; cl.Value = 4; }),
                                                 Helpers.Create <NewMechanics.IncreaseAllSpellsCLForSpecificSpellbook>(cl => { cl.spellbook = archetype.GetParentClass().Spellbook; cl.Value = 5; }),
                                                 Helpers.Create <NewMechanics.IncreaseAllSpellsCLForSpecificSpellbook>(cl => { cl.spellbook = archetype.GetParentClass().Spellbook; cl.Value = 6; })
                                                 );

            var channels = ChannelEnergyEngine.getChannelAbilities(e => e.scalesWithClass(archetype.GetParentClass())).ToArray();

            channel_dc_bonuses = createSacredBondAbility("SacredServantDivineBondChannelDCBonus",
                                                         "Channel Energy DC Bonus",
                                                         divine_bond_buff.Description,
                                                         channel_dc_icon,
                                                         Helpers.Create <NewMechanics.ContextIncreaseAbilitiesDC>(c => { c.abilities = channels; c.Value = 1; }),
                                                         Helpers.Create <NewMechanics.ContextIncreaseAbilitiesDC>(c => { c.abilities = channels; c.Value = 2; }),
                                                         Helpers.Create <NewMechanics.ContextIncreaseAbilitiesDC>(c => { c.abilities = channels; c.Value = 3; }),
                                                         Helpers.Create <NewMechanics.ContextIncreaseAbilitiesDC>(c => { c.abilities = channels; c.Value = 4; }),
                                                         Helpers.Create <NewMechanics.ContextIncreaseAbilitiesDC>(c => { c.abilities = channels; c.Value = 5; }),
                                                         Helpers.Create <NewMechanics.ContextIncreaseAbilitiesDC>(c => { c.abilities = channels; c.Value = 6; })
                                                         );

            channel_dice_bonuses = createSacredBondAbility("SacredServantDivineBondChannelDiceBonus",
                                                           "Channel Energy Dice Bonus",
                                                           divine_bond_buff.Description,
                                                           channel_dice_icon,
                                                           Helpers.Create <NewMechanics.ContextIncreaseCasterLevelForSelectedSpells>(c => { c.spells = channels; c.value = 2; }),
                                                           Helpers.Create <NewMechanics.ContextIncreaseCasterLevelForSelectedSpells>(c => { c.spells = channels; c.value = 4; }),
                                                           Helpers.Create <NewMechanics.ContextIncreaseCasterLevelForSelectedSpells>(c => { c.spells = channels; c.value = 6; }),
                                                           Helpers.Create <NewMechanics.ContextIncreaseCasterLevelForSelectedSpells>(c => { c.spells = channels; c.value = 8; }),
                                                           Helpers.Create <NewMechanics.ContextIncreaseCasterLevelForSelectedSpells>(c => { c.spells = channels; c.value = 10; }),
                                                           Helpers.Create <NewMechanics.ContextIncreaseCasterLevelForSelectedSpells>(c => { c.spells = channels; c.value = 12; })
                                                           );

            for (int i = 0; i < 6; i++)
            {
                divine_bond[i] = Helpers.CreateFeature($"SacredServantDivineBond{i+1}Feature",
                                                       divine_bond_ability.Name,
                                                       divine_bond_ability.Description,
                                                       "",
                                                       divine_bond_ability.Icon,
                                                       FeatureGroup.None);
                if (i == 0)
                {
                    divine_bond[i].AddComponent(resource.CreateAddAbilityResource());
                    divine_bond[i].AddComponent(Helpers.CreateAddFact(divine_bond_ability));
                }
                else
                {
                    divine_bond[i].AddComponent(Common.createIncreaseActivatableAbilityGroupSize(ActivatableAbilityGroup.DivineWeaponProperty));
                }
                divine_bond[i].AddComponent(Helpers.CreateAddFacts(cl_bonuses[i], channel_dc_bonuses[i], channel_dice_bonuses[i]));
            }
        }
Esempio n. 9
0
        public BlueprintFeature createPlanarFocus(string ext, BlueprintFeature prerequisite_to_share_with_ac)
        {
            var outsider = library.Get <BlueprintFeature>("9054d3988d491d944ac144e27b6bc318");

            var airborne = library.Get <BlueprintFeature>("70cffb448c132fa409e49156d013b175");

            planar_focus_air = createToggleFocus(prefix + "PlanarFocusAir",
                                                 "Planar Focus: Air",
                                                 "You gain limited levitation ability that gives you immunity to difficult terrain and ground based effects.",
                                                 "",
                                                 "",
                                                 library.Get <BlueprintFeature>("f48c7d56a8a13af4d8e1cc9aae579b01").Icon, //elemental movement
                                                 Helpers.Create <AddConditionImmunity>(a => a.Condition = UnitCondition.DifficultTerrain),
                                                 Common.createSpellImmunityToSpellDescriptor(SpellDescriptor.Ground),
                                                 Common.createBuffDescriptorImmunity(SpellDescriptor.Ground)
                                                 );

            planar_focus_chaos = createToggleFocus(prefix + "PlanarFocusChaos",
                                                   "Planar Focus: Chaos",
                                                   "Your form shifts subtly, making it difficult for others to aim precise attacks against you. You gain a 25% chance to negate extra damage from critical hits and precision damage from attacks made against you (such as from sneak attacks). Only chaotic characters can use this planar focus.",
                                                   "",
                                                   "",
                                                   library.Get <BlueprintAbility>("1eaf1020e82028d4db55e6e464269e00").Icon,  //protection from chaos
                                                   Common.createAddFortification(25)
                                                   );
            planar_focus_chaos.AddComponent(Helpers.Create <NewMechanics.ActivatableAbilityAlignmentRestriction>(c => c.Alignment = Kingmaker.UnitLogic.Alignments.AlignmentMaskType.Chaotic));

            var deal_cold_damage = Helpers.CreateActionDealDamage(DamageEnergyType.Cold,
                                                                  Helpers.CreateContextDiceValue(DiceType.D4, Helpers.CreateContextValue(AbilityRankType.DamageDice)),
                                                                  IgnoreCritical: true);

            planar_focus_cold = createToggleFocus(prefix + "PlanarFocusCold",
                                                  "Planar Focus: Cold",
                                                  "Creatures that attack you with natural attacks or melee weapons take 1d4 points of cold damage for every 4 class levels you possess.",
                                                  "",
                                                  "",
                                                  library.Get <BlueprintAbility>("021d39c8e0eec384ba69140f4875e166").Icon, //protection from cold
                                                  Common.createAddTargetAttackWithWeaponTrigger(Helpers.CreateActionList(),
                                                                                                Helpers.CreateActionList(deal_cold_damage)
                                                                                                ),
                                                  Helpers.CreateContextRankConfig(ContextRankBaseValueTypeExtender.MasterMaxClassLevelWithArchetype.ToContextRankBaseValueType(),
                                                                                  ContextRankProgression.StartPlusDivStep,
                                                                                  AbilityRankType.DamageDice,
                                                                                  startLevel: delay,
                                                                                  stepLevel: 4,
                                                                                  classes: allowed_classes, archetype: allowed_archetype)
                                                  );


            planar_focus_earth = createToggleFocus(prefix + "PlanarFocusEarth",
                                                   "Planar Focus: Earth",
                                                   "You gain +2 bonus to CMB when performing bull rush maneuver, and a +2 bonus to CMD when defending against it. You also receive +2 enhancement bonus to your natural armor.",
                                                   "",
                                                   "",
                                                   library.Get <BlueprintAbility>("c66e86905f7606c4eaa5c774f0357b2b").Icon,  //stone skin
                                                   Common.createManeuverBonus(Kingmaker.RuleSystem.Rules.CombatManeuver.BullRush, 2),
                                                   Common.createManeuverDefenseBonus(Kingmaker.RuleSystem.Rules.CombatManeuver.BullRush, 2),
                                                   Common.createAddGenericStatBonus(2, ModifierDescriptor.NaturalArmorEnhancement, StatType.AC)
                                                   );

            planar_focus_evil = createToggleFocus(prefix + "PlanarFocusEvil",
                                                  "Planar Focus: Evil",
                                                  $"You gain a +1 profane bonus to AC and on saves against attacks made and effects created by good outsiders. This bonus increases to +2 at {10+delay}th level. Only evil characters can use this planar focus.",
                                                  "",
                                                  "",
                                                  library.Get <BlueprintAbility>("b56521d58f996cd4299dab3f38d5fe31").Icon,   //profane nimbus
                                                  Common.createContextACBonusAgainstFactOwner(outsider, AlignmentComponent.Good, Helpers.CreateContextValue(AbilityRankType.StatBonus), ModifierDescriptor.Profane),
                                                  Common.createContextSavingThrowBonusAgainstFact(outsider, AlignmentComponent.Good, Helpers.CreateContextValue(AbilityRankType.StatBonus), ModifierDescriptor.Profane),
                                                  Helpers.CreateContextRankConfig(ContextRankBaseValueTypeExtender.MasterMaxClassLevelWithArchetype.ToContextRankBaseValueType(),
                                                                                  ContextRankProgression.StartPlusDivStep,
                                                                                  AbilityRankType.StatBonus,
                                                                                  startLevel: delay,
                                                                                  stepLevel: 10,
                                                                                  max: 2,
                                                                                  classes: allowed_classes, archetype: allowed_archetype)
                                                  );
            planar_focus_evil.AddComponent(Helpers.Create <NewMechanics.ActivatableAbilityAlignmentRestriction>(c => c.Alignment = Kingmaker.UnitLogic.Alignments.AlignmentMaskType.Evil));


            planar_focus_fire = createToggleFocus(prefix + "PlanarFocusFire",
                                                  "Planar Focus: Fire",
                                                  "Your natural attacks and melee weapons deal 1d3 points of fire damage for every 4 class levels you possess.",
                                                  "",
                                                  "",
                                                  library.Get <BlueprintActivatableAbility>("7902941ef70a0dc44bcfc174d6193386").Icon, //weapon bond flaming
                                                  Common.createAddWeaponEnergyDamageDiceBuff(Helpers.CreateContextDiceValue(DiceType.D3, Helpers.CreateContextValue(AbilityRankType.DamageDice)),
                                                                                             DamageEnergyType.Fire,
                                                                                             AttackType.Melee, AttackType.Touch),
                                                  Helpers.CreateContextRankConfig(ContextRankBaseValueTypeExtender.MasterMaxClassLevelWithArchetype.ToContextRankBaseValueType(),
                                                                                  ContextRankProgression.StartPlusDivStep,
                                                                                  AbilityRankType.DamageDice,
                                                                                  startLevel: delay + 4,
                                                                                  stepLevel: 4,
                                                                                  classes: allowed_classes, archetype: allowed_archetype)
                                                  );

            planar_focus_good = createToggleFocus(prefix + "PlanarFocusGood",
                                                  "Planar Focus: Good",
                                                  $"You gain a +1 sacred bonus to AC and on saves against attacks made or effects created by evil outsiders. This bonus increases to +2 at {10+delay}th level. Only good characters can use this planar focus.",
                                                  "",
                                                  "",
                                                  library.Get <BlueprintAbility>("bf74b3b54c21a9344afe9947546e036f").Icon, //sacred nimbus
                                                  Common.createContextACBonusAgainstFactOwner(outsider, AlignmentComponent.Evil, Helpers.CreateContextValue(AbilityRankType.StatBonus), ModifierDescriptor.Sacred),
                                                  Common.createContextSavingThrowBonusAgainstFact(outsider, AlignmentComponent.Evil, Helpers.CreateContextValue(AbilityRankType.StatBonus), ModifierDescriptor.Sacred),
                                                  Helpers.CreateContextRankConfig(ContextRankBaseValueTypeExtender.MasterMaxClassLevelWithArchetype.ToContextRankBaseValueType(),
                                                                                  ContextRankProgression.StartPlusDivStep,
                                                                                  AbilityRankType.StatBonus,
                                                                                  startLevel: delay,
                                                                                  stepLevel: 10,
                                                                                  max: 2,
                                                                                  classes: allowed_classes, archetype: allowed_archetype)
                                                  );
            planar_focus_good.AddComponent(Helpers.Create <NewMechanics.ActivatableAbilityAlignmentRestriction>(c => c.Alignment = Kingmaker.UnitLogic.Alignments.AlignmentMaskType.Good));

            planar_focus_law = createToggleFocus(prefix + "PlanarFocusLaw",
                                                 "Planar Focus: Law",
                                                 "You gain immunity to polymorph spells.",
                                                 "",
                                                 "",
                                                 library.Get <BlueprintAbility>("c3aafbbb6e8fc754fb8c82ede3280051").Icon, //protection from law
                                                 Common.createSpellImmunityToSpellDescriptor(SpellDescriptor.Polymorph)
                                                 );
            planar_focus_law.AddComponent(Helpers.Create <NewMechanics.ActivatableAbilityAlignmentRestriction>(c => c.Alignment = Kingmaker.UnitLogic.Alignments.AlignmentMaskType.Lawful));

            planar_focus_water = createToggleFocus(prefix + "PlanarFocusWater",
                                                   "Planar Focus: Water",
                                                   "You gain immunity to combat maneuvers.",
                                                   "",
                                                   "",
                                                   library.Get <BlueprintAbility>("3e4ab69ada402d145a5e0ad3ad4b8564").Icon,  //mirror image
                                                   Helpers.Create <AddCondition>(c => c.Condition = UnitCondition.ImmuneToCombatManeuvers)
                                                   );


            planar_focus_shadow = createToggleFocus(prefix + "PlanarFocusShadow",
                                                    "Planar Focus: Shadow",
                                                    "You gain a +5 bonus on Stealth and Trickery checks.",
                                                    "",
                                                    "",
                                                    library.Get <BlueprintAbility>("f001c73999fb5a543a199f890108d936").Icon, //vanish
                                                    Helpers.CreateAddStatBonus(StatType.SkillStealth, 5, ModifierDescriptor.UntypedStackable),
                                                    Helpers.CreateAddStatBonus(StatType.SkillThievery, 5, ModifierDescriptor.UntypedStackable)
                                                    );


            BlueprintActivatableAbility[] foci = new BlueprintActivatableAbility[] { planar_focus_air, planar_focus_chaos, planar_focus_cold, planar_focus_earth,
                                                                                     planar_focus_evil, planar_focus_fire, planar_focus_good, planar_focus_law, planar_focus_shadow };

            string description = "When you use your animal focus class feature, you can choose any of the following new aspects unless they conflict with your alignment.";

            foreach (var f in foci)
            {
                description += "\n" + f.Name + " - " + f.Description;
            }

            var planar_focus_ac = Helpers.CreateFeature(prefix + "PlanarFocusAcFeature",
                                                        "",
                                                        "",
                                                        "",
                                                        null,
                                                        FeatureGroup.None,
                                                        Helpers.CreateAddFacts(foci)
                                                        );

            planar_focus = Helpers.CreateFeature(prefix + "PlanarFocusFeature",
                                                 $"Planar Focus ({ext})",
                                                 description,
                                                 "",
                                                 null,
                                                 FeatureGroup.Feat,
                                                 Helpers.CreateAddFacts(foci),
                                                 Helpers.PrerequisiteStatValue(StatType.SkillLoreReligion, 5)
                                                 );
            //planar_focus.AddComponent(Common.createAddFeatToAnimalCompanion(planar_focus));
            planar_focus.AddComponent(Common.createAddFeatureIfHasFact(prerequisite_to_share_with_ac, Common.createAddFeatToAnimalCompanion(planar_focus, "")));

            library.AddFeats(planar_focus);

            return(planar_focus);
        }
 public static void SetActivateWithUnitCommand(this BlueprintActivatableAbility blueprintAbility, UnitCommand.CommandType value)
 {
     blueprintAbility.SetFieldValue("m_ActivateWithUnitCommand", value);
 }
        private static List <BlueprintFeature> AddWarriorSpirit()
        {
            BlueprintItemEnchantment[] defaultEnchantments = new BlueprintItemEnchantment[]
            {
                library.Get <BlueprintItemEnchantment>("d704f90f54f813043a525f304f6c0050"),
                library.Get <BlueprintItemEnchantment>("9e9bab3020ec5f64499e007880b37e52"),
                library.Get <BlueprintItemEnchantment>("d072b841ba0668846adeb007f623bd6c"),
                library.Get <BlueprintItemEnchantment>("6a6a0901d799ceb49b33d4851ff72132"),
                library.Get <BlueprintItemEnchantment>("746ee366e50611146821d61e391edf16")
            };

            BlueprintActivatableAbility[] MagusFacts = new BlueprintActivatableAbility[]
            {
                library.Get <BlueprintActivatableAbility>("05b7cbe45b1444a4f8bf4570fb2c0208"),
                library.Get <BlueprintActivatableAbility>("b338e43a8f81a2f43a73a4ae676353a5"),
                library.Get <BlueprintActivatableAbility>("a3a9e9a2f909cd74e9aee7788a7ec0c6"),
                library.Get <BlueprintActivatableAbility>("24fe1f546e07987418557837b0e0f8f5"),
                library.Get <BlueprintActivatableAbility>("85742dd6788c6914f96ddc4628b23932")
            };
            BlueprintActivatableAbility[] facts = new BlueprintActivatableAbility[MagusFacts.Length];

            for (int i = 0; i < MagusFacts.Length; i++)
            {
                BlueprintActivatableAbility magusAbility = MagusFacts[i];
                BlueprintActivatableAbility temp         = library.CopyAndAdd(magusAbility, magusAbility.Name, Helpers.getGuid(magusAbility.AssetGuid + "WarriorSpirit"));
                temp.AddComponent(Helpers.Create <ActivatableAbilityGroupSizeRestriction>(x =>
                {
                    x.EnchantPool        = EnchantPoolType.ArcanePool;
                    x.ActivatableAbility = temp;
                }));
                facts[i] = temp;
            }

            ContextDurationValue contextDurationValue = Helpers.CreateContextDuration(rate: DurationRate.Minutes, bonus: 1);

            BlueprintAbility         arcaneWeaponSwitchAbility = library.Get <BlueprintAbility>("3c89dfc82c2a3f646808ea250eb91b91");
            BlueprintAbilityResource arcanePoolResourse        = library.Get <BlueprintAbilityResource>("effc3e386331f864e9e06d19dc218b37");


            var divineFavor = library.Get <BlueprintAbility>("9d5d2d3ffdd73c648af3eb3e585b1113");

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

            foreach (var weaponTraining in _weaponTrainingBluePrints)
            {
                string weaponTrainingName        = getWeaponTrainingName(weaponTraining, true);
                string weaponTrainingDisplayName = getWeaponTrainingName(weaponTraining);

                BlueprintAbilityResource resource = Helpers.Create <WarriorSpiritPoolLogic>(x => x.WeaponTraining = weaponTraining);
                resource.name                 = "WarriorSpiritResource" + weaponTrainingName;
                resource.LocalizedName        = Helpers.CreateString("WarriorSpiritResource.Name", "Warrior Spirit Resource (" + weaponTrainingDisplayName + ")");
                resource.LocalizedDescription = Helpers.CreateString("WarriorSpiritResource.Name", "Each day, he designates one such weapon and gains a number of points of spiritual energy equal to 1 + his weapon training bonus.");
                resource.SetIcon(arcaneWeaponSwitchAbility.Icon);

                Traverse traverseOne = Traverse.Create(arcanePoolResourse);
                Traverse traverseTwo = Traverse.Create(resource);
                traverseTwo.Field("m_MaxAmount").SetValue(traverseOne.Field("m_MaxAmount").GetValue());

                Main.library.AddAsset(resource, Helpers.getGuid("WarriorSpiritResource" + weaponTrainingName));

                ContextActionWeaponEnchantPoolWarriorSpirit contextActionWeaponEnchantPool = Helpers.Create <ContextActionWeaponEnchantPoolWarriorSpirit>();
                contextActionWeaponEnchantPool.DurationValue       = contextDurationValue;
                contextActionWeaponEnchantPool.EnchantPool         = EnchantPoolType.ArcanePool;
                contextActionWeaponEnchantPool.Group               = ActivatableAbilityGroup.ArcaneWeaponProperty;
                contextActionWeaponEnchantPool.DefaultEnchantments = defaultEnchantments;
                contextActionWeaponEnchantPool.Feature             = weaponTraining;


                BlueprintAbility warriorSpiritSwitchAbility = Helpers.CreateAbility(
                    "WarriorSpiritSwitchAbility" + weaponTrainingName,
                    "Warrior Spirit " + getWeaponTrainingName(weaponTraining),
                    "The fighter can forge a spiritual bond with a weapon that belongs to the associated weapon group, allowing him to unlock the weapon’s potential. Each day, he designates one such weapon and gains a number of points of spiritual energy equal to 1 + his weapon training bonus. While wielding this weapon, he can spend 1 point of spiritual energy to grant the weapon an enhancement bonus equal to his weapon training bonus. Enhancement bonuses gained by this advanced weapon training option stack with those of the weapon, to a maximum of +5. The fighter can also imbue the weapon with any one weapon special ability with an equivalent enhancement bonus less than or equal to his maximum bonus by reducing the granted enhancement bonus by the amount of the equivalent enhancement bonus. The item must have an enhancement bonus of at least +1 (from the item itself or from warrior spirit) to gain a weapon special ability. In either case, these bonuses last for 1 minute.",
                    Helpers.getGuid("WarriorSpiritSwitchAbility" + weaponTrainingName),
                    arcaneWeaponSwitchAbility.Icon,
                    AbilityType.Supernatural,
                    arcaneWeaponSwitchAbility.ActionType,
                    arcaneWeaponSwitchAbility.Range,
                    "1 min",
                    arcaneWeaponSwitchAbility.LocalizedSavingThrow,
                    divineFavor.GetComponent <AbilitySpawnFx>(), // TODO!!!!!
                    Helpers.CreateContextRankConfig(
                        ContextRankBaseValueType.FeatureRank,
                        ContextRankProgression.AsIs,
                        AbilityRankType.Default,
                        feature: weaponTraining),
                    Helpers.CreateRunActions(contextActionWeaponEnchantPool),
                    Helpers.Create <AbilityResourceLogic>(x =>
                {
                    x.Amount           = 1;
                    x.RequiredResource = resource;
                    x.IsSpendResource  = true;
                    x.CostIsCustom     = false;
                })
                    );

                features.Add(Helpers.CreateFeature(
                                 "WarriorSpiritFeature" + weaponTrainingName,
                                 "Warrior Spirit (" + weaponTrainingDisplayName + ")",
                                 "The fighter can forge a spiritual bond with a weapon that belongs to the associated weapon group, allowing him to unlock the weapon’s potential. Each day, he designates one such weapon and gains a number of points of spiritual energy equal to 1 + his weapon training bonus. While wielding this weapon, he can spend 1 point of spiritual energy to grant the weapon an enhancement bonus equal to his weapon training bonus. Enhancement bonuses gained by this advanced weapon training option stack with those of the weapon, to a maximum of +5. The fighter can also imbue the weapon with any one weapon special ability with an equivalent enhancement bonus less than or equal to his maximum bonus by reducing the granted enhancement bonus by the amount of the equivalent enhancement bonus. The item must have an enhancement bonus of at least +1 (from the item itself or from warrior spirit) to gain a weapon special ability. In either case, these bonuses last for 1 minute.",
                                 Helpers.getGuid("WarriorSpiritFeature" + weaponTrainingName),
                                 arcaneWeaponSwitchAbility.Icon,
                                 FeatureGroup.CombatFeat,
                                 warriorSpiritSwitchAbility.CreateAddFact(),
                                 resource.CreateAddAbilityResource(),
                                 Helpers.CreateAddFacts(facts),
                                 weaponTraining.PrerequisiteFeature(),
                                 Helpers.Create <IncreaseActivatableAbilityGroupSizeBaseOnFeatureRanks>(x =>
                {
                    x.Group   = ActivatableAbilityGroup.ArcaneWeaponProperty;
                    x.Feature = weaponTraining;
                })
                                 ));
            }

            return(features);
        }
        public static void Load()
        {
            BlueprintCharacterClass inquisitor            = library.Get <BlueprintCharacterClass>("f1a70d9e1b0b41e49874e1fa9052a1ce"); // Inquisitor
            BlueprintProgression    inquisitorProgression = library.Get <BlueprintProgression>("4e945c2fe5e252f4ea61eee7fb560017");    // InquisitorProgression

            livingGrimoire = Helpers.Create <BlueprintArchetype>(l =>
            {
                l.name                 = "LivingGrimoireArchetype";
                l.LocalizedName        = Helpers.CreateString("LivingGrimoire.Name", "Living Grimoire");
                l.LocalizedDescription = Helpers.CreateString("LivingGrimoire.Description", "The living grimoire literally wields the sacred word of his deity, using his holy tome to smite the foes of his god with divine might. Unlike most inquisitors, a living grimoire focuses on careful study of divine scripture, valuing knowledge over intuition.");
            });

            livingGrimoireArray = new BlueprintArchetype[] { livingGrimoire };
            library.AddAsset(livingGrimoire, Helpers.getGuid("LivingGrimoireArchetype"));
            livingGrimoire.SetIcon(inquisitor.Icon);
            livingGrimoire.BaseAttackBonus = inquisitor.BaseAttackBonus;
            livingGrimoire.FortitudeSave   = inquisitor.FortitudeSave;
            livingGrimoire.ReflexSave      = inquisitor.ReflexSave;
            livingGrimoire.WillSave        = inquisitor.WillSave;

            Helpers.SetField(livingGrimoire, "m_ParentClass", inquisitor);

            livingGrimoire.LocalizedName = Helpers.CreateString("LivingGrimoire.Name", "Living Grimoire");

            BlueprintSpellbook MagusSpellbook      = library.Get <BlueprintSpellbook>("5d8d04e76dff6c5439de99af0d57be63"); // MagusSpellbook
            BlueprintSpellbook InquisitorSpellbook = library.Get <BlueprintSpellbook>("57fab75111f377248810ece84193a5a5"); // InquisitorSpellbook
            BlueprintSpellbook spellbook           = Helpers.Create <BlueprintSpellbook>();

            spellbook.name = "LivingGrimoireSpellbook";
            library.AddAsset(spellbook, Helpers.getGuid("LivingGrimoireSpellbook"));
            spellbook.Name             = livingGrimoire.LocalizedName;
            spellbook.SpellsPerDay     = MagusSpellbook.SpellsPerDay;
            spellbook.SpellList        = InquisitorSpellbook.SpellList;
            spellbook.CharacterClass   = inquisitor;
            spellbook.CastingAttribute = StatType.Intelligence;
            spellbook.Spontaneous      = false;
            spellbook.SpellsPerLevel   = 2;
            spellbook.AllSpellsKnown   = false;
            spellbook.CanCopyScrolls   = true;
            spellbook.IsArcane         = false;
            spellbook.CantripsType     = CantripsType.Orisions;


            livingGrimoire.ReplaceSpellbook = spellbook;

            BlueprintItem[] items = new BlueprintItem[]
            {
                (BlueprintItem)((IList <BlueprintCategoryDefaults.CategoryDefaultEntry>)Game.Instance.BlueprintRoot.Progression.CategoryDefaults.Entries).FirstOrDefault <BlueprintCategoryDefaults.CategoryDefaultEntry>((Func <BlueprintCategoryDefaults.CategoryDefaultEntry, bool>)(p => p.Key == WeaponCategory.LightMace))?.DefaultWeapon,
                library.Get <BlueprintItem>("f4cef3ba1a15b0f4fa7fd66b602ff32b"),
                library.Get <BlueprintItem>("d7963e1fcf260c148877afd3252dbc91"),
                library.Get <BlueprintItem>("ec619484fb1a13441b30f6d08e1c5b6f")
            };

            livingGrimoire.StartingItems = items;


            BlueprintFeature HolyBookFeature = Helpers.CreateFeature(
                "HolyBook",
                "Holy Book",
                "At 1st level, a living grimoire forms a supernatural bond with a large ironbound tome containing the holy text of his deity and learns to use it as a weapon.\n When wielding the holy book as a weapon, he deals base damage as if it were a cold iron light mace(but see Sacred Word below), is considered proficient with the book, takes no improvised weapon penalty, and gains a + 1 bonus on attack rolls with the book.The tome serves as his holy symbol and divine focus, and can be enchanted as a magic weapon. \nHe can replace his bonded tome with another book at any time, though he must perform a 24 - hour binding ritual to attune himself to the new book. \n Dev note: This ability works with all light maces.",
                Helpers.getGuid("HolyBook"),
                null,
                FeatureGroup.None,
                Helpers.Create <HolyBookLogic>()
                );

            BlueprintFeature SacredWordFeature = Helpers.CreateFeature(
                "SacredWord",
                "Sacred Word",
                "At 1st (level, a living grimoire learns to charge his holy book with the power of his faith. The inquisitor gains the benefits of the warpriest’s sacred weapon class ability, but the benefits apply only to his bonded holy book. Like a warpriest’s sacred weapon, the living grimoire’s book deals damage based on the inquisitor’s level, not the book’s base damage (unless the inquisitor chooses to use the book’s base damage).\nAt 4th level, the living grimoire gains the ability to enhance his holy book with divine power as a swift action.This ability grants the holy book a + 1 enhancement bonus.For every 4 inquisitor levels the living grimoire has beyond 4th, this bonus increases by 1(to a maximum of + 5 at 20th level).\nThese bonuses stack with any existing bonuses the holy book might have, to a maximum of + 5.The living grimoire can enhance his holy book to have any of the special abilities listed in the warpriest’s sacred weapon ability, subject to the same alignment restrictions, but adds bane to the general special ability list.Adding any of these special abilities to the holy book consumes an amount of enhancement bonus equal to the special ability’s base price modifier.The holy book must have at least a + 1 enhancement bonus before the living grimoire can add any special abilities to it.The living grimoire can use this ability a number of rounds per day equal to his inquisitor level, but these rounds don’t need to be consecutive.As with the warpriest sacred weapon ability, he determines the enhancement bonus and special abilities the first time he uses the ability each day, and they cannot be changed until the next day. \nThis ability replaces judgment.\n Dev note: This ability works with all light maces.",
                Helpers.getGuid("SacredWordFeature"),
                null,
                FeatureGroup.None,
                Helpers.Create <FocusedWeaponLogic>(x =>
            {
                x.Category = WeaponCategory.LightMace;
                x.Class    = inquisitor;
            })
                );

            BlueprintFeature SacredWordFeature1d8 = Helpers.CreateFeature(
                "SacredWord_1d8",
                "Sacred Word 1d8",
                "The damage of your holy book (light maces) increases to 1d8.",
                Helpers.getGuid("SacredWord_1d8"),
                null,
                FeatureGroup.None
                );

            BlueprintFeature SacredWordFeature1d10 = Helpers.CreateFeature(
                "SacredWord_1d10",
                "Sacred Word 1d10",
                "The damage of your holy book (light maces) increases to 1d10.",
                Helpers.getGuid("SacredWord_1d10"),
                null,
                FeatureGroup.None
                );

            BlueprintFeature SacredWordFeature2d6 = Helpers.CreateFeature(
                "SacredWord_2d6",
                "Sacred Word 2d6",
                "The damage of your holy book (light maces) increases to 2d6.",
                Helpers.getGuid("SacredWord_2d6"),
                null,
                FeatureGroup.None
                );

            BlueprintFeature SacredWordFeature2d8 = Helpers.CreateFeature(
                "SacredWord_2d8",
                "Sacred Word 2d8",
                "The damage of your holy book (light maces) increases to 2d8.",
                Helpers.getGuid("SacredWord_2d8"),
                null,
                FeatureGroup.None
                );


            BlueprintBuff InspireCourageBuff = library.Get <BlueprintBuff>("b4027a834204042409248889cc8abf67");
            BlueprintActivatableAbility InspireCourageToggleAbility = library.Get <BlueprintActivatableAbility>("5250fe10c377fdb49be449dfe050ba70"); // InspireCourageToggleAbility

            BlueprintItemEnchantment[] defaultEnchantments = new BlueprintItemEnchantment[]
            {
                library.Get <BlueprintItemEnchantment>("d704f90f54f813043a525f304f6c0050"),
                library.Get <BlueprintItemEnchantment>("9e9bab3020ec5f64499e007880b37e52"),
                library.Get <BlueprintItemEnchantment>("d072b841ba0668846adeb007f623bd6c"),
                library.Get <BlueprintItemEnchantment>("6a6a0901d799ceb49b33d4851ff72132"),
                library.Get <BlueprintItemEnchantment>("746ee366e50611146821d61e391edf16")
            };

            BlueprintBuff SacredWordBuff = Helpers.CreateBuff(
                "SacredWordBuff",
                "Sacred Word",
                "",
                Helpers.getGuid("SacredWordBuff"),
                null,
                InspireCourageBuff.FxOnStart,
                Helpers.Create <AddSacredWordBonus>(x =>
            {
                x.DefaultEnchantments = defaultEnchantments;
                x.DurationValue       = Helpers.CreateContextDuration(rate: DurationRate.Rounds, bonus: 1);
                x.Group       = ActivatableAbilityGroup.DivineWeaponProperty;
                x.EnchantPool = EnchantPoolType.DivineWeaponBond;
            })
                );

            BlueprintAbilityResource abilityResource = Helpers.CreateAbilityResource(
                "SacredWordResource",
                "Sacred Word Resource",
                "",
                Helpers.getGuid("SacredWordResource"),
                null
                );

            abilityResource.SetIncreasedByLevel(1, 1, new BlueprintCharacterClass[] { inquisitor });

            BlueprintAbility            WeaponBondSwitchAbility = library.Get <BlueprintAbility>("7ff088ab58c69854b82ea95c2b0e35b4"); //WeaponBondSwitchAbility
            BlueprintActivatableAbility SacredWordToggleAbility = Helpers.CreateActivatableAbility(
                "SacredWordSwitchAbility",
                "Sacred Word",
                "",
                Helpers.getGuid("SacredWordSwitchAbility"),
                WeaponBondSwitchAbility.Icon,
                SacredWordBuff,
                AbilityActivationType.WithUnitCommand,
                UnitCommand.CommandType.Swift,
                InspireCourageToggleAbility.ActivateWithUnitAnimation,
                abilityResource.CreateActivatableResourceLogic(ActivatableAbilityResourceLogic.ResourceSpendType.NewRound)
                );

            SacredWordToggleAbility.DeactivateIfCombatEnded   = true;
            SacredWordToggleAbility.DeactivateIfOwnerDisabled = true;


            BlueprintActivatableAbility SacredWordFrost      = library.CopyAndAdd <BlueprintActivatableAbility>("b338e43a8f81a2f43a73a4ae676353a5", "SacredWordFrost", Helpers.getGuid("SacredWordFrost"));           // ArcaneWeaponFrostChoice
            BlueprintActivatableAbility SacredWordShock      = library.CopyAndAdd <BlueprintActivatableAbility>("a3a9e9a2f909cd74e9aee7788a7ec0c6", "SacredWordShock", Helpers.getGuid("SacredWordShock"));           // ArcaneWeaponShockChoice
            BlueprintActivatableAbility SacredWordAnarchic   = library.CopyAndAdd <BlueprintActivatableAbility>("8ed07b0cc56223c46953348f849f3309", "SacredWordAnarchic", Helpers.getGuid("SacredWordAnarchic"));     // ArcaneWeaponAnarchicChoice
            BlueprintActivatableAbility SacredWordGhostTouch = library.CopyAndAdd <BlueprintActivatableAbility>("688d42200cbb2334c8e27191c123d18f", "SacredWordGhostTouch", Helpers.getGuid("SacredWordGhostTouch")); // ArcaneWeaponGhostTouchChoice
            BlueprintActivatableAbility SacredWordUnholy     = library.CopyAndAdd <BlueprintActivatableAbility>("561803a819460f34ea1fe079edabecce", "SacredWordUnholy", Helpers.getGuid("SacredWordUnholy"));         // ArcaneWeaponUnholyChoice
            BlueprintActivatableAbility SacredWordBane       = library.CopyAndAdd <BlueprintActivatableAbility>("3a909d1effa3bbc4084f2b5ac95f5306", "SacredWordBane", Helpers.getGuid("SacredWordBane"));             // ArcaneWeaponUnholyChoice

            SacredWordFrost.Group        = ActivatableAbilityGroup.DivineWeaponProperty;
            SacredWordShock.Group        = ActivatableAbilityGroup.DivineWeaponProperty;
            SacredWordAnarchic.Group     = ActivatableAbilityGroup.DivineWeaponProperty;
            SacredWordGhostTouch.Group   = ActivatableAbilityGroup.DivineWeaponProperty;
            SacredWordUnholy.Group       = ActivatableAbilityGroup.DivineWeaponProperty;
            SacredWordBane.Group         = ActivatableAbilityGroup.DivineWeaponProperty;
            SacredWordBane.WeightInGroup = 1;



            BlueprintFeature SacredWordFeatureLevel4 = Helpers.CreateFeature(
                "SacredWord_FeatureLevel4",
                "Sacred Word",
                "At 4th level, the living grimoire gains the ability to enhance his holy book with divine power as a swift action.This ability grants the holy book a + 1 enhancement bonus.For every 4 inquisitor levels the living grimoire has beyond 4th, this bonus increases by 1(to a maximum of + 5 at 20th level).\nThese bonuses stack with any existing bonuses the holy book might have, to a maximum of + 5.The living grimoire can enhance his holy book to have any of the special abilities listed in the warpriest’s sacred weapon ability, subject to the same alignment restrictions, but adds bane to the general special ability list.Adding any of these special abilities to the holy book consumes an amount of enhancement bonus equal to the special ability’s base price modifier.The holy book must have at least a + 1 enhancement bonus before the living grimoire can add any special abilities to it.The living grimoire can use this ability a number of rounds per day equal to his inquisitor level, but these rounds don’t need to be consecutive.As with the warpriest sacred weapon ability, he determines the enhancement bonus and special abilities the first time he uses the ability each day, and they cannot be changed until the next day. \nThis ability replaces judgment.\n Dev note: This ability works with all light maces.",
                Helpers.getGuid("SacredWord_FeatureLevel4"),
                null,
                FeatureGroup.None,
                Helpers.CreateAddFacts(new BlueprintUnitFact[]
            {
                SacredWordToggleAbility,
                library.Get <BlueprintActivatableAbility>("7902941ef70a0dc44bcfc174d6193386"),    //WeaponBondFlamingChoice
                library.Get <BlueprintActivatableAbility>("27d76f1afda08a64d897cc81201b5218"),    //WeaponBondKeenChoice
                SacredWordFrost,
                SacredWordShock,
                SacredWordGhostTouch,
            }),
                Helpers.Create <AddAbilityResources>(x =>
            {
                x.UseThisAsResource = false;
                x.Resource          = library.Get <BlueprintAbilityResource>("3683d1af071c1744185ff93cba9db10b"); // WeaponBondResourse
                x.Amount            = 0;
                x.RestoreAmount     = true;
                x.RestoreOnLevelUp  = false;
            }),
                abilityResource.CreateAddAbilityResource(),
                Helpers.Create <IncreaseResourcesByClass>(x =>
            {
                x.CharacterClass = inquisitor;
                x.Resource       = abilityResource;
                x.BaseValue      = 1;
            })

                );

            BlueprintFeature SacredWordPlus2 = Helpers.CreateFeature(
                "SacredWord_Plus2",
                "Sacred Word",
                "Increases the enchantment bonus from Sacred Word by 1. Adds the enchantments Anarchic, Axiomatic, Disruption, Holy, Unholy",
                Helpers.getGuid("SacredWord_Plus2"),
                null,
                FeatureGroup.None,
                Helpers.Create <IncreaseActivatableAbilityGroupSize>(x => x.Group = ActivatableAbilityGroup.DivineWeaponProperty),
                Helpers.CreateAddFacts(new BlueprintUnitFact[]
            {
                library.Get <BlueprintActivatableAbility>("d76e8a80ab14ac942b6a9b8aaa5860b1"),    //WeaponBondAxiomaticChoice
                library.Get <BlueprintActivatableAbility>("ce0ece459ebed9941bb096f559f36fa8"),    //WeaponBondHolyChoice
                library.Get <BlueprintActivatableAbility>("8c714fbd564461e4588330aeed2fbe1d"),    //WeaponBondDisruptionChoice
                SacredWordAnarchic,
                SacredWordUnholy,
                SacredWordBane
            }));

            BlueprintFeature SacredWordPlus3 = Helpers.CreateFeature(
                "SacredWord_Plus3",
                "Sacred Word",
                "Increases the enchantment bonus from Sacred Word by 1.",
                Helpers.getGuid("SacredWord_Plus3"),
                null,
                FeatureGroup.None,
                Helpers.Create <IncreaseActivatableAbilityGroupSize>(x => x.Group = ActivatableAbilityGroup.DivineWeaponProperty)
                );

            BlueprintFeature SacredWordPlus4 = Helpers.CreateFeature(
                "SacredWord_Plus4",
                "Sacred Word",
                "Increases the enchantment bonus from Sacred Word by 1. Adds the enchantment Brilliant Energy",
                Helpers.getGuid("SacredWord_Plus4"),
                null,
                FeatureGroup.None,
                Helpers.Create <IncreaseActivatableAbilityGroupSize>(x => x.Group = ActivatableAbilityGroup.DivineWeaponProperty),
                Helpers.CreateAddFacts(new BlueprintUnitFact[]
            {
                library.Get <BlueprintActivatableAbility>("f1eec5cc68099384cbfc6964049b24fa"),    //WeaponBondBrilliantEnergyChoice
            }));

            BlueprintFeature SacredWordPlus5 = Helpers.CreateFeature(
                "SacredWord_Plus5",
                "Sacred Word",
                "Increases the enchantment bonus from Sacred Word by 1.",
                Helpers.getGuid("SacredWord_Plus5"),
                null,
                FeatureGroup.None,
                Helpers.Create <IncreaseActivatableAbilityGroupSize>(x => x.Group = ActivatableAbilityGroup.DivineWeaponProperty)
                );

            BlueprintFeatureSelection BlessedScriptSelection = Helpers.CreateFeatureSelection(
                "BlessedScript",
                "Blessed Script",
                "At 5th level, a living grimoire can permanently tattoo one spell of 2nd level or lower from his holy book onto his body. The tattooed spell cannot have an expensive material component or focus. The living grimoire can cast his tattooed spells as a spell-like ability once per day.",
                Helpers.getGuid("BlessedScript"),
                null,
                FeatureGroup.None
                );

            List <BlueprintFeatureSelection> BlessedScriptSpellLevelSelection = new List <BlueprintFeatureSelection>();

            for (int i = 1; i < 7; i++)
            {
                BlueprintFeatureSelection BlessedScriptSpellSelection = Helpers.CreateFeatureSelection(
                    "BlessedScriptLevel" + (i),
                    "Blessed Script Level " + (i),
                    "At 5th level, a living grimoire can permanently tattoo one spell of 2nd level or lower from his holy book onto his body. The tattooed spell cannot have an expensive material component or focus. The living grimoire can cast his tattooed spells as a spell-like ability once per day.",
                    Helpers.getGuid("BlessedScriptLevel" + (i)),
                    null,
                    FeatureGroup.None,
                    inquisitor.PrerequisiteClassLevel((i - 1) * 4)
                    );
                List <BlueprintFeature> SpellSelection = new List <BlueprintFeature>();
                foreach (BlueprintAbility Spell in InquisitorSpellbook.SpellList.GetSpells(i))
                {
                    if (Spell.MaterialComponent.Item != null)
                    {
                        continue;
                    }

                    BlueprintAbilityResource BlessedScriptAbilityResource = Helpers.CreateAbilityResource(
                        "BlessedScriptAbilityResource" + Spell.name,
                        "",
                        "",
                        Helpers.getGuid("BlessedScriptAbilityResource" + Spell.name),
                        null);
                    BlessedScriptAbilityResource.SetFixedResource(1);


                    BlueprintAbility ability        = library.CopyAndAdd(Spell, "BlessedScriptAbility" + Spell.name, Helpers.getGuid("BlessedScriptAbility" + Spell.name));
                    SpellComponent   spellComponent = ability.GetComponent <SpellComponent>();
                    if (spellComponent != null)
                    {
                        ability.RemoveComponent(spellComponent);
                    }
                    ability.AddComponent(Helpers.Create <AbilityResourceLogic>(x =>
                    {
                        x.Amount           = 1;
                        x.IsSpendResource  = true;
                        x.CostIsCustom     = false;
                        x.RequiredResource = BlessedScriptAbilityResource;
                    }));

                    BlueprintFeature BlessedScriptSpell = Helpers.CreateFeature(
                        "BlessedScript" + Spell.name,
                        "Blessed Script (" + Spell.Name + ")",
                        "You have tattooed the spell \"" + Spell.Name + "\" onto your body. You can  can cast his tattooed spells as a spell-like ability once per day.",
                        Helpers.getGuid("BlessedScript" + Spell.name),
                        null,
                        FeatureGroup.None,
                        Helpers.Create <PrerequisiteKnowsSpell>(x =>
                    {
                        x.Ability        = Spell;
                        x.CharacterClass = inquisitor;
                    }),
                        Helpers.CreateAddFacts(ability),
                        Helpers.CreateAddAbilityResource(BlessedScriptAbilityResource)
                        );
                    BlessedScriptSpell.AddComponent(BlessedScriptSpell.PrerequisiteNoFeature());
                    SpellSelection.Add(BlessedScriptSpell);
                }
                BlessedScriptSpellSelection.SetFeatures(SpellSelection);
                BlessedScriptSpellLevelSelection.Add(BlessedScriptSpellSelection);
            }
            BlessedScriptSelection.SetFeatures(BlessedScriptSpellLevelSelection);


            BlueprintBuff TrueJudgmentCooldownBuff = library.Get <BlueprintBuff>("65058aafc91a12042b158527f9d0506a");

            ContextValue CooldownBuff = new ContextValue();

            CooldownBuff.Value = 24;

            BlueprintAbilityResource WordOfGodAbilityResource = Helpers.CreateAbilityResource(
                "WordOfGodAbilityResource",
                "",
                "",
                Helpers.getGuid("WordOfGodAbilityResource"),
                null);

            WordOfGodAbilityResource.SetFixedResource(7);

            AbilityEffectRunAction   abilityEffectRunAction = Helpers.Create <AbilityEffectRunAction>();
            ContextActionSavingThrow savingThrow            = Helpers.Create <ContextActionSavingThrow>();

            savingThrow.Type = SavingThrowType.Fortitude;

            ContextActionConditionalSaved saved = Helpers.Create <ContextActionConditionalSaved>();

            saved.Succeed = new ActionList
            {
                Actions = new GameAction[]
                {
                    Helpers.Create <ContextActionApplyBuff>(ap =>
                    {
                        ap.Buff          = TrueJudgmentCooldownBuff;
                        ap.DurationValue = Helpers.CreateContextDuration(CooldownBuff, DurationRate.Hours);
                    })
                }
            };
            saved.Failed = new ActionList {
                Actions = new GameAction[] { Helpers.Create <ContextActionKillTarget>() }
            };
            savingThrow.Actions = new ActionList {
                Actions = new GameAction[] { saved }
            };


            Conditional conditional = Helpers.Create <Conditional>();

            conditional.ConditionsChecker = new ConditionsChecker();

            ContextConditionHasBuffFromCaster condition = Helpers.Create <ContextConditionHasBuffFromCaster>();

            condition.Buff = TrueJudgmentCooldownBuff;

            conditional.ConditionsChecker.Conditions = new Condition[] { condition };
            conditional.IfFalse = new ActionList {
                Actions = new GameAction[] { savingThrow }
            };

            abilityEffectRunAction.Actions = new ActionList {
                Actions = new GameAction[] { conditional }
            };

            BlueprintAbility TrueJudgmentAbility = library.Get <BlueprintAbility>("d69715dc0de8f8b44ac9f20188c7c22e");

            BlueprintAbility WordOfGodAbility = Helpers.CreateAbility(
                "WordOfGodAbility",
                "Word of God",
                "At 20th level, a living grimoire can smite his foes with the holy word of his deity. Up to seven times per day, the inquisitor can make a single melee attack with his holy book against a target. If the attack hits, it deals damage normally and the target must succeed at a Fortitude save or die (DC = 10 + 1/2 the living grimoire’s inquisitor level + his Intelligence modifier). Regardless of whether the save is successful, the target creature is immune to the living grimoire’s word of god ability for 24 hours. Once the living grimoire uses this ability, he can’t use it again for 1d4 rounds.\nThis ability replaces true judgment.",
                Helpers.getGuid("WordOfGodAbility"),
                TrueJudgmentAbility.Icon,
                AbilityType.Supernatural,
                UnitCommand.CommandType.Standard,
                AbilityRange.Weapon,
                "Instant",
                "Fortitude",
                abilityEffectRunAction
                ,
                Helpers.Create <AbilityResourceLogic>(x =>
            {
                x.Amount           = 1;
                x.IsSpendResource  = true;
                x.CostIsCustom     = false;
                x.RequiredResource = WordOfGodAbilityResource;
            })
                );

            WordOfGodAbility.CanTargetEnemies = true;
            WordOfGodAbility.CanTargetSelf    = false;

            BlueprintFeature TrueJudgmentFeature = library.Get <BlueprintFeature>("f069b6557a2013544ac3636219186632"); // TrueJudgmentFeature

            BlueprintFeature WordOfGod = Helpers.CreateFeature("WordOfGod",
                                                               "Word of God",
                                                               "At 20th level, a living grimoire can smite his foes with the holy word of his deity. Up to seven times per day, the inquisitor can make a single melee attack with his holy book against a target. If the attack hits, it deals damage normally and the target must succeed at a Fortitude save or die (DC = 10 + 1/2 the living grimoire’s inquisitor level + his Intelligence modifier). Regardless of whether the save is successful, the target creature is immune to the living grimoire’s word of god ability for 24 hours. Once the living grimoire uses this ability, he can’t use it again for 1d4 rounds.\nThis ability replaces true judgment.",
                                                               Helpers.getGuid("WordOfGod"),
                                                               TrueJudgmentFeature.Icon,
                                                               FeatureGroup.None,
                                                               Helpers.CreateAddFacts(WordOfGodAbility),
                                                               Helpers.Create <ReplaceAbilitiesStat>(x =>
            {
                x.Stat    = StatType.Intelligence;
                x.Ability = new BlueprintAbility[] { WordOfGodAbility };
            }),
                                                               Helpers.Create <ReplaceCasterLevelOfAbility>(x =>
            {
                x.Spell = WordOfGodAbility;
                x.Class = inquisitor;
            }),
                                                               WordOfGodAbilityResource.CreateAddAbilityResource()
                                                               );

            List <LevelEntry> addFeatures = new List <LevelEntry>();

            addFeatures.Add(Helpers.LevelEntry(1, HolyBookFeature, SacredWordFeature));
            addFeatures.Add(Helpers.LevelEntry(4, SacredWordFeatureLevel4));
            addFeatures.Add(Helpers.LevelEntry(5, BlessedScriptSelection, SacredWordFeature1d8));
            addFeatures.Add(Helpers.LevelEntry(8, SacredWordPlus2, BlessedScriptSelection));
            addFeatures.Add(Helpers.LevelEntry(10, SacredWordFeature1d10));
            addFeatures.Add(Helpers.LevelEntry(12, SacredWordPlus3, BlessedScriptSelection));
            addFeatures.Add(Helpers.LevelEntry(15, SacredWordFeature2d6));
            addFeatures.Add(Helpers.LevelEntry(16, SacredWordPlus4, BlessedScriptSelection));
            addFeatures.Add(Helpers.LevelEntry(20, SacredWordPlus5, WordOfGod, SacredWordFeature2d8));


            BlueprintFeature JudgmentAdditionalUse = library.Get <BlueprintFeature>("ee50875819478774b8968701893b52f5"); //JudgmentAdditionalUse
            BlueprintFeature SecondJudgment        = library.Get <BlueprintFeature>("33bf0404b70d65f42acac989ec5295b2"); // SecondJudgment
            BlueprintFeature ThirdJudgment         = library.Get <BlueprintFeature>("490c7e92b22cc8a4bb4885a027b355db"); // ThirdJudgment

            List <LevelEntry> removeFeatures = new List <LevelEntry>();

            removeFeatures.Add(Helpers.LevelEntry(1, library.Get <BlueprintFeature>("981def910b98200499c0c8f85a78bde8"))); //JudgmentFeature
            removeFeatures.Add(Helpers.LevelEntry(2, library.Get <BlueprintFeature>("6be8b4031d8b9fc4f879b72b5428f1e0"))); //CunningInitiative
            removeFeatures.Add(Helpers.LevelEntry(4, JudgmentAdditionalUse));
            removeFeatures.Add(Helpers.LevelEntry(5, library.Get <BlueprintFeature>("7ddf7fbeecbe78342b83171d888028cf"))); //InquisitorBaneNormalFeatureAdd
            removeFeatures.Add(Helpers.LevelEntry(7, JudgmentAdditionalUse));
            removeFeatures.Add(Helpers.LevelEntry(8, SecondJudgment));
            removeFeatures.Add(Helpers.LevelEntry(10, JudgmentAdditionalUse));
            removeFeatures.Add(Helpers.LevelEntry(12, library.Get <BlueprintFeature>("6e694114b2f9e0e40a6da5d13736ff33")));//InquisitorBaneGreaterFeature
            removeFeatures.Add(Helpers.LevelEntry(13, JudgmentAdditionalUse));
            removeFeatures.Add(Helpers.LevelEntry(16, JudgmentAdditionalUse, ThirdJudgment));
            removeFeatures.Add(Helpers.LevelEntry(19, JudgmentAdditionalUse));
            removeFeatures.Add(Helpers.LevelEntry(20, TrueJudgmentFeature));

            livingGrimoire.AddFeatures    = addFeatures.ToArray();
            livingGrimoire.RemoveFeatures = removeFeatures.ToArray();

            UIGroup SacredWordGroup = new UIGroup();

            SacredWordGroup.Features.Add(SacredWordFeature);
            SacredWordGroup.Features.Add(SacredWordFeatureLevel4);
            SacredWordGroup.Features.Add(SacredWordPlus2);
            SacredWordGroup.Features.Add(SacredWordPlus3);
            SacredWordGroup.Features.Add(SacredWordPlus4);
            SacredWordGroup.Features.Add(SacredWordPlus5);
            SacredWordGroup.Features.Add(SacredWordFeature1d8);
            SacredWordGroup.Features.Add(SacredWordFeature1d10);
            SacredWordGroup.Features.Add(SacredWordFeature2d6);
            SacredWordGroup.Features.Add(SacredWordFeature2d8);
            inquisitorProgression.UIGroups = inquisitorProgression.UIGroups.AddToArray(SacredWordGroup);
            UIGroup BlessedScriptGroup = new UIGroup();

            BlessedScriptGroup.Features.Add(BlessedScriptSelection);
            inquisitorProgression.UIGroups = inquisitorProgression.UIGroups.AddToArray(BlessedScriptGroup);

            List <BlueprintArchetype> archetypes = inquisitor.Archetypes.ToList();

            archetypes.Insert(0, livingGrimoire);
            inquisitor.Archetypes = archetypes.ToArray();
        }
Esempio n. 13
0
 public ActivateAbilityProvider(UnitEntityData executor, BlueprintActivatableAbility ability)
 {
     unit = executor;
     activatable_ability = ability;
 }