Exemple #1
0
        static void createZeal()
        {
            var ruthless_combatant = Helpers.CreateFeature("ZealPhantomRuthlessCombatantFeature",
                                                           "Ruthless Combatant",
                                                           "The phantom threatens a critical hit with its slam attacks on a roll of 19–20. When the spiritualist reaches 11th level, the phantom’s critical modifier with slam attacks increases to ×3. This doesn’t stack with Improved Critical or similar effects.",
                                                           "",
                                                           Helpers.GetIcon("7812ad3672a4b9a4fb894ea402095167"),//improved unarmed strike
                                                           FeatureGroup.None,
                                                           Helpers.Create <WeaponTypeCriticalEdgeIncrease>(w => w.WeaponType = library.Get <BlueprintWeaponType>("f18cbcb39a1b35643a8d129b1ec4e716"))
                                                           );

            var ruthless_combatant_spiritualist = Helpers.CreateFeature("ZealPhantomExciterRuthlessCombatantFeature",
                                                                        "Ruthless Combatant",
                                                                        "The phantom threatens a critical hit with its slam attacks on a roll of 19–20. When the spiritualist reaches 11th level, the phantom’s critical modifier with slam attacks increases to ×3. This doesn’t stack with Improved Critical or similar effects.",
                                                                        "",
                                                                        Helpers.GetIcon("7812ad3672a4b9a4fb894ea402095167"),//improved unarmed strike
                                                                        FeatureGroup.None,
                                                                        Helpers.Create <NewMechanics.AttackTypeCriticalEdgeIncrease>(w => w.Type = AttackTypeAttackBonus.WeaponRangeType.Melee)
                                                                        );

            var ruthless_combatant2 = Helpers.CreateFeature("ZealPhantomRuthlessCombatantFeature2",
                                                            "",
                                                            "",
                                                            "",
                                                            Helpers.GetIcon("7812ad3672a4b9a4fb894ea402095167"),//improved unarmed strike
                                                            FeatureGroup.None,
                                                            Helpers.Create <WeaponTypeCriticalMultiplierIncrease>(w => { w.WeaponType = library.Get <BlueprintWeaponType>("f18cbcb39a1b35643a8d129b1ec4e716"); w.AdditionalMultiplier = 1; })
                                                            );

            ruthless_combatant2.HideInCharacterSheetAndLevelUp = true;
            ruthless_combatant2.HideInUI = true;
            ruthless_combatant.AddComponent(ruthless_combatant2.CreateAddFeatureOnClassLevel(9, getPhantomArray()));

            var ruthless_combatant2_spiritualist = Helpers.CreateFeature("ZealPhantomExciterRuthlessCombatantFeature2",
                                                                         "",
                                                                         "",
                                                                         "",
                                                                         Helpers.GetIcon("7812ad3672a4b9a4fb894ea402095167"),//improved unarmed strike
                                                                         FeatureGroup.None,
                                                                         Helpers.Create <AttackTypeCriticalMultiplierIncrease>(w => { w.Type = AttackTypeAttackBonus.WeaponRangeType.Melee; w.AdditionalMultiplier = 1; })
                                                                         );

            ruthless_combatant2_spiritualist.HideInCharacterSheetAndLevelUp = true;
            ruthless_combatant2_spiritualist.HideInUI = true;
            ruthless_combatant_spiritualist.AddComponent(ruthless_combatant2_spiritualist.CreateAddFeatureOnClassLevel(9, Spiritualist.getSpiritualistArray()));

            var determination_aura_buff = Helpers.CreateBuff("ZealPhantomDeterminationAuraEffectBuff",
                                                             "Determination Aura",
                                                             "When the spiritualist reaches 7th level, as a swift action, the phantom can emit a 20-footradius aura that grants its zeal to nearby allies. Allies within the aura gain a +2 competence bonus on attack rolls and saving throws.",
                                                             "",
                                                             Helpers.GetIcon("87ab2fed7feaaff47b62a3320a57ad8d"), //heroism
                                                             null,
                                                             Helpers.CreateAddStatBonus(StatType.AdditionalAttackBonus, 2, Kingmaker.Enums.ModifierDescriptor.Competence),
                                                             Helpers.CreateAddStatBonus(StatType.SaveFortitude, 2, Kingmaker.Enums.ModifierDescriptor.Competence),
                                                             Helpers.CreateAddStatBonus(StatType.SaveReflex, 2, Kingmaker.Enums.ModifierDescriptor.Competence),
                                                             Helpers.CreateAddStatBonus(StatType.SaveWill, 2, Kingmaker.Enums.ModifierDescriptor.Competence)
                                                             );

            var toggle = Common.createToggleAreaEffect(determination_aura_buff, 20.Feet(), Helpers.CreateConditionsCheckerAnd(),
                                                       AbilityActivationType.WithUnitCommand,
                                                       UnitCommand.CommandType.Swift,
                                                       Common.createPrefabLink("63f322580ec0e7c4c96fc62ecabad40f"), //axiomatic
                                                       null
                                                       );

            toggle.DeactivateIfOwnerDisabled = true;
            var determination_aura = Common.ActivatableAbilityToFeature(toggle, false);

            var haste          = library.Get <BlueprintAbility>("486eaff58293f6441a5c2759c4872f98");
            var haste_resource = Helpers.CreateAbilityResource("ZealPhantomHasteResource", "", "", "", null);

            haste_resource.SetFixedResource(3);
            var haste_spell_like = Common.convertToSpellLike(haste, "ZealPhantom", getPhantomArray(), StatType.Charisma, haste_resource, no_scaling: true);
            var zeal_haste       = Common.AbilityToFeature(haste_spell_like, false);

            zeal_haste.AddComponent(haste_resource.CreateAddAbilityResource());
            zeal_haste.SetNameDescription("Haste", "When the spiritualist reaches 12th level, three times per day as a standard action, the phantom can use haste as spell-like ability using his Hit Dice as caster level.");



            var zeals_resolve_resource = Helpers.CreateAbilityResource("ZealPhantomZealsResolveResource", "", "", "", null);

            zeals_resolve_resource.SetFixedResource(3);

            var rule_types = new ModifyD20WithActions.RuleType[] { ModifyD20WithActions.RuleType.AttackRoll,
                                                                   ModifyD20WithActions.RuleType.SavingThrow };
            var names     = new string[] { "Attack Roll", "Saving Throw" };
            var abilities = new List <BlueprintActivatableAbility>();

            for (int i = 0; i < rule_types.Length; i++)
            {
                var buff2 = library.CopyAndAdd <BlueprintBuff>("3bc40c9cbf9a0db4b8b43d8eedf2e6ec", rule_types[i].ToString() + "ZealPhantomZealsResolveBuff", "");
                buff2.SetNameDescription("Zeal’s Resolve" + ": " + names[i],
                                         "When the spiritualist reaches 17th level, three times per day as a free action, when the phantom misses with an attack roll or fails a saving throw, it can reroll the failed attack or saving throw. It must take the new result, even if that result is worse.");
                buff2.RemoveComponents <ModifyD20>();
                buff2.AddComponent(Helpers.Create <NewMechanics.ModifyD20WithActions>(m =>
                {
                    m.Rule               = rule_types[i];
                    m.RollsAmount        = 1;
                    m.TakeBest           = true;
                    m.RerollOnlyIfFailed = true;
                    m.actions            = Helpers.CreateActionList(Common.createContextActionSpendResource(zeals_resolve_resource, 1));
                    m.required_resource  = zeals_resolve_resource;
                })
                                   );
                var ability2 = Helpers.CreateActivatableAbility(rule_types[i].ToString() + "ZealPhantomZealsResolve" + "ToggleAbility",
                                                                buff2.Name,
                                                                buff2.Description,
                                                                "",
                                                                buff2.Icon,
                                                                buff2,
                                                                AbilityActivationType.Immediately,
                                                                Kingmaker.UnitLogic.Commands.Base.UnitCommand.CommandType.Free,
                                                                null,
                                                                Helpers.CreateActivatableResourceLogic(zeals_resolve_resource, ActivatableAbilityResourceLogic.ResourceSpendType.Never)
                                                                );
                ability2.DeactivateImmediately = true;
                abilities.Add(ability2);
            }


            var zeals_resolve = Helpers.CreateFeature("ZealPhantomZealsResolveFeature",
                                                      "Zeal’s Resolve",
                                                      abilities[0].Description,
                                                      "",
                                                      abilities[0].Icon,
                                                      FeatureGroup.None,
                                                      Helpers.CreateAddFacts(abilities.ToArray()),
                                                      zeals_resolve_resource.CreateAddAbilityResource()
                                                      );

            var skill_phantom = Helpers.CreateFeature("ZealPhantomBaseFeature",
                                                      "Tracking",
                                                      "The phantom adds half its number of Hit Dice (minimum 1) to Lore (Nature) checks.",
                                                      "",
                                                      Helpers.GetIcon("6507d2da389ed55448e0e1e5b871c013"),
                                                      FeatureGroup.None,
                                                      Helpers.CreateAddContextStatBonus(StatType.SkillLoreNature, ModifierDescriptor.UntypedStackable),
                                                      Helpers.CreateContextRankConfig(Kingmaker.UnitLogic.Mechanics.Components.ContextRankBaseValueType.ClassLevel,
                                                                                      classes: getPhantomArray(),
                                                                                      progression: Kingmaker.UnitLogic.Mechanics.Components.ContextRankProgression.Div2,
                                                                                      min: 1
                                                                                      )
                                                      );


            var zeal_archetype = createPhantomArchetype("ZealPhantomArchetype",
                                                        "Zeal",
                                                        true,
                                                        true,
                                                        false,
                                                        new StatType[] { StatType.SkillMobility, StatType.SkillLoreNature },
                                                        new LevelEntry[] { Helpers.LevelEntry(1, skill_phantom) },
                                                        new LevelEntry[] { Helpers.LevelEntry(1) }
                                                        );

            //bless, false life, heroism, freedom of movement, joyful rapture, heroism greater
            createPhantom("Zeal",
                          "Zeal",
                          "A phantom with this emotional focus fixates on every task given as if it were the phantom’s last. The most basic commands are treated as life-and-death situations, and the truly dangerous ones are faced with a resolve and tenacity that sometimes defies common sense. Zeal phantoms take the form of steadfast protectors or daring and manic creatures looking for the next challenge or opportunity to prove itself to either its master or itself. Often very prideful creatures, these phantoms display an orange aura upon completing their tasks. They are prone to boast about their accomplishments and chastise those around them for not accomplishing more.\n"
                          + "Skills: The phantom gains a number of ranks in Mobility and Lore (Nature) equal to its number of Hit Dice. While confined in the spiritualist’s consciousness, the phantom grants the spiritualist Skill Focus in each of these skills.\n"
                          + "Good Saves: Fortitude and Will.\n"
                          + "Tracking: The phantom adds half its number of Hit Dice (minimum 1) to Lore (Nature) checks.",
                          determination_aura.Icon,
                          zeal_archetype,
                          ruthless_combatant, determination_aura, zeal_haste, zeals_resolve,
                          new StatType[] { StatType.SkillMobility, StatType.SkillLoreNature },
                          12, 14,
                          new BlueprintAbility[]
            {
                library.Get <BlueprintAbility>("90e59f4a4ada87243b7b3535a06d0638"),             //bless
                NewSpells.force_sword,
                library.Get <BlueprintAbility>("9d5d2d3ffdd73c648af3eb3e585b1113"),             //divine favor
                library.Get <BlueprintAbility>("0087fc2d64b6095478bc7b8d7d512caf")              //freedom of movement
            },
                          ruthless_combatant_spiritualist,
                          determination_aura,
                          emotion_conduit_spells: new BlueprintAbility[]
            {
                library.Get <BlueprintAbility>("90e59f4a4ada87243b7b3535a06d0638"),             //bless
                library.Get <BlueprintAbility>("7a5b5bf845779a941a67251539545762"),             //false life
                library.Get <BlueprintAbility>("5ab0d42fb68c9e34abae4921822b9d63"),             //heroism
                library.Get <BlueprintAbility>("0087fc2d64b6095478bc7b8d7d512caf"),             //freedom of movement
                library.Get <BlueprintAbility>("15a04c40f84545949abeedef7279751a"),             //joyful rapture
                library.Get <BlueprintAbility>("e15e5e7045fda2244b98c8f010adfe31")              //heroism greater
            }
                          );
        }
        static void createPhantom(string name, string display_name, string descripton, UnityEngine.Sprite icon,
                                  BlueprintArchetype archetype,
                                  BlueprintFeature feature1, BlueprintFeature feature7, BlueprintFeature feature12, BlueprintFeature feature17,
                                  StatType[] skills, int str_value, int dex_value,
                                  BlueprintAbility[] spell_like_abilities,
                                  BlueprintFeature exciter_feature1 = null, BlueprintFeature exciter_feature2 = null
                                  )
        {
            var ghost_fx = library.Get <BlueprintBuff>("20f79fea035330b479fc899fa201d232");

            var natural_armor2 = library.Get <BlueprintUnitFact>("45a52ce762f637f4c80cc741c91f58b7");
            var spectre        = library.Get <BlueprintUnit>("2f91d7337b60e3b4b9b137198a8c8745");
            var unit           = library.CopyAndAdd <BlueprintUnit>(spectre, name + "PhantomUnit", "");


            unit.Alignment                     = Alignment.TrueNeutral;
            unit.Strength                      = str_value;
            unit.Dexterity                     = dex_value;
            unit.Constitution                  = 13;
            unit.Intelligence                  = 7;
            unit.Wisdom                        = 10;
            unit.Charisma                      = 13;
            unit.Speed                         = 30.Feet();
            unit.AddFacts                      = new BlueprintUnitFact[] { natural_armor2, ghost_fx };
            unit.Body                          = unit.Body.CloneObject();
            unit.Body.EmptyHandWeapon          = library.Get <BlueprintItemWeapon>("767e6932882a99c4b8ca95c88d823137");
            unit.Body.PrimaryHand              = null;
            unit.Body.SecondaryHand            = null;
            unit.Body.AdditionalLimbs          = new BlueprintItemWeapon[0];
            unit.Body.AdditionalSecondaryLimbs = new BlueprintItemWeapon[0];
            unit.Body.DisableHands             = false;
            unit.ReplaceComponent <AddClassLevels>(a =>
            {
                a.DoNotApplyAutomatically = true;
                a.Levels         = 0;
                a.Archetypes     = new BlueprintArchetype[] { archetype };
                a.CharacterClass = phantom_class;
                a.Skills         = new StatType[] { StatType.SkillAthletics, StatType.SkillMobility, StatType.SkillStealth, StatType.SkillPersuasion, StatType.SkillKnowledgeArcana }.RemoveFromArray(skills[0]).RemoveFromArray(skills[1]);
                a.Selections     = new SelectionEntry[0];
            });
            Helpers.SetField(unit, "m_Portrait", phantom_portrait);
            unit.AddComponents(Helpers.Create <Eidolon.EidolonComponent>());
            unit.AddComponents(Helpers.Create <AllowDyingCondition>());
            unit.AddComponents(Helpers.Create <AddResurrectOnRest>());
            unit.LocalizedName        = unit.LocalizedName.CreateCopy();
            unit.LocalizedName.String = Helpers.CreateString(unit.name + ".Name", display_name + " Phantom");
            unit.RemoveComponents <Experience>();
            unit.RemoveComponents <AddTags>();
            unit.Brain                        = library.Get <BlueprintBrain>("cf986dd7ba9d4ec46ad8a3a0406d02ae");   //character brain
            unit.Faction                      = library.Get <BlueprintFaction>("d8de50cc80eb4dc409a983991e0b77ad"); //neutrals
            unit.Visual                       = library.Get <BlueprintUnit>("8a6986e17799d7d4b90f0c158b31c5b9").Visual.CloneObject();
            unit.Visual.BloodType             = Kingmaker.Visual.HitSystem.BloodType.BlackUndead;
            unit.Visual.FootstepSoundSizeType = Kingmaker.Visual.Sound.FootstepSoundSizeType.Ghost;
            unit.Visual.Barks                 = spectre.Visual.Barks;
            unit.Race = null;
            var pain_unit = library.CopyAndAdd(unit, "Pain" + unit.name, "");

            pain_unit.ReplaceComponent <AddClassLevels>(a => a.Archetypes = new BlueprintArchetype[] { pain_phantom_archetype_map[archetype] });

            var progression = Helpers.CreateProgression(name + "PhantomProgression",
                                                        "Emotion Focus: " + display_name,
                                                        descripton,
                                                        "",
                                                        icon,
                                                        FeatureGroup.AnimalCompanion,
                                                        library.Get <BlueprintFeature>("126712ef923ab204983d6f107629c895").ComponentsArray
                                                        );

            progression.IsClassFeature   = true;
            progression.ReapplyOnLevelUp = true;
            progression.Classes          = new BlueprintCharacterClass[] { Spiritualist.spiritualist_class };
            progression.ReplaceComponent <AddPet>(a => a.Pet = unit);

            var feature1_s  = Common.createAddFeatToAnimalCompanion(feature1, "");
            var feature7_s  = Common.createAddFeatToAnimalCompanion(feature7, "");
            var feature12_s = Common.createAddFeatToAnimalCompanion(feature12, "");
            var feature17_s = Common.createAddFeatToAnimalCompanion(feature17, "");


            BlueprintFeature[] spell_likes = new BlueprintFeature[spell_like_abilities.Length];

            for (int i = 0; i < spell_like_abilities.Length; i++)
            {
                var resource = Helpers.CreateAbilityResource(name + spell_like_abilities[i].name + "Resource", "", "", "", null);
                resource.SetIncreasedByLevelStartPlusDivStep(0, i == 3 ? 16 : 5 + i * 2, 1, 4, 1, 0, 0.0f, Spiritualist.getSpiritualistArray());

                BlueprintAbility ability          = null;
                BlueprintAbility ability_charisma = null;
                if (!spell_like_abilities[i].HasVariants)
                {
                    ability = Common.convertToSpellLike(spell_like_abilities[i], name, Spiritualist.getSpiritualistArray(), StatType.Wisdom,
                                                        resource);
                    ability_charisma = Common.convertToSpellLike(spell_like_abilities[i], "Charisma" + name, Spiritualist.getSpiritualistArray(), StatType.Charisma,
                                                                 resource);
                }
                else
                {
                    List <BlueprintAbility> variants          = new List <BlueprintAbility>();
                    List <BlueprintAbility> variants_charisma = new List <BlueprintAbility>();
                    foreach (var v in spell_like_abilities[i].Variants)
                    {
                        var a = Common.convertToSpellLike(v, name, Spiritualist.getSpiritualistArray(), StatType.Wisdom,
                                                          resource);
                        variants.Add(a);

                        var a_charisma = Common.convertToSpellLike(v, "Charisma" + name, Spiritualist.getSpiritualistArray(), StatType.Charisma,
                                                                   resource);
                        variants_charisma.Add(a_charisma);
                    }

                    ability = Common.createVariantWrapper(name + spell_like_abilities[i].name, "", variants.ToArray());
                    ability.SetNameDescriptionIcon(spell_like_abilities[i]);

                    ability_charisma = Common.createVariantWrapper("Charisma" + name + spell_like_abilities[i].name, "", variants_charisma.ToArray());
                    ability_charisma.SetNameDescriptionIcon(spell_like_abilities[i]);
                }
                spell_likes[i] = Common.AbilityToFeature(ability, false);
                spell_likes[i].SetComponents(Common.createAddFeatureIfHasFact(Spiritualist.charisma_spellcasting, ability, not: true),
                                             Common.createAddFeatureIfHasFact(Spiritualist.charisma_spellcasting, ability_charisma)
                                             );
                spell_likes[i].AddComponent(resource.CreateAddAbilityResource());
                spell_likes[i].SetNameDescription("Emotional Power: " + spell_likes[i].Name,
                                                  "A spiritualist gains a number of spell-like abilities, which are tied to her phantom’s emotional focus. She gains one spell-like ability at 5th level, a second at 7th level, a third at 9th level, and a fourth at 16th level. A spiritualist can use each of these abilities once per day, plus one additional time per day for every 4 spiritualist levels she possesses beyond the level at which she gained the spell-like ability. The saving throw DCs for these spell-like abilities are equal to 10 + 1/2 spiritualist class level + Wisdom modifier, rather than being based on the spell’s level.\n"
                                                  + spell_like_abilities[i].Name + ": " + spell_like_abilities[i].Description);
            }

            progression.LevelEntries = new LevelEntry[] { Helpers.LevelEntry(1, feature1_s),
                                                          Helpers.LevelEntry(5, spell_likes[0]),
                                                          Helpers.LevelEntry(7, feature7_s, spell_likes[1]),
                                                          Helpers.LevelEntry(9, spell_likes[2]),
                                                          Helpers.LevelEntry(12, feature12_s),
                                                          Helpers.LevelEntry(16, spell_likes[3]),
                                                          Helpers.LevelEntry(17, feature17_s) };
            progression.UIGroups = new UIGroup[] { Helpers.CreateUIGroup(feature1_s, feature7_s, feature12_s, feature17_s),
                                                   Helpers.CreateUIGroup(spell_likes) };

            var pain_progression = library.CopyAndAdd(progression, "Pain" + progression.name, "");

            pain_progression.ReplaceComponent <AddPet>(a => a.Pet = pain_unit);

            var capstone = Helpers.CreateFeature(name + "PotentPhantomFeature",
                                                 "Potent Phantom: " + display_name,
                                                 descripton,
                                                 "",
                                                 icon,
                                                 FeatureGroup.None,
                                                 Helpers.CreateAddFacts(feature1_s, feature7_s, feature12_s, feature17_s),
                                                 Helpers.PrerequisiteNoFeature(progression)
                                                 );

            phantom_progressions[name]      = progression;
            pain_phantom_progressions[name] = pain_progression;
            progression.AddComponent(Helpers.Create <NewMechanics.FeatureReplacement>(f => f.replacement_feature = pain_progression));
            potent_phantom[name] = capstone;

            phantom_skill_foci[name] = new List <BlueprintFeature>();
            var skill_foci = library.Get <BlueprintFeatureSelection>("c9629ef9eebb88b479b2fbc5e836656a").AllFeatures;

            for (int i = 0; i < skill_foci.Length; i++)
            {
                StatType stat = skill_foci[i].GetComponent <AddContextStatBonus>().Stat;
                if (skills.Contains(stat))
                {
                    phantom_skill_foci[name].Add(skill_foci[i]);
                }
            }


            if (exciter_feature1 == null)
            {
                return;
            }

            var exciter_progression = Helpers.CreateProgression(name + "ExciterProgression",
                                                                "Emotion Focus: " + display_name,
                                                                descripton,
                                                                "",
                                                                icon,
                                                                FeatureGroup.AnimalCompanion
                                                                );

            exciter_progression.Classes      = new BlueprintCharacterClass[] { Spiritualist.spiritualist_class };
            exciter_progression.LevelEntries = new LevelEntry[] { Helpers.LevelEntry(2, exciter_feature1),
                                                                  Helpers.LevelEntry(5, spell_likes[0]),
                                                                  Helpers.LevelEntry(7, exciter_feature2, spell_likes[1]),
                                                                  Helpers.LevelEntry(9, spell_likes[2]),
                                                                  Helpers.LevelEntry(16, spell_likes[3]) };
            exciter_progression.UIGroups = new UIGroup[] { Helpers.CreateUIGroup(exciter_feature1, exciter_feature2),
                                                           Helpers.CreateUIGroup(spell_likes) };
            exciter_progressions[name] = exciter_progression;


            var exciter_capstone = Helpers.CreateFeature(name + "ExciterPotentPhantomFeature",
                                                         "Potent Phantom: " + display_name,
                                                         descripton,
                                                         "",
                                                         icon,
                                                         FeatureGroup.None,
                                                         Helpers.CreateAddFacts(exciter_feature1, exciter_feature2),
                                                         Helpers.PrerequisiteNoFeature(exciter_progression)
                                                         );
        }