Ejemplo n.º 1
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);
        }
        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);
        }