コード例 #1
0
        static void createCruelEnchant()
        {
            var description  = "When the wielder strikes a creature that is frightened, shaken, or panicked with a cruel weapon, that creature becomes sickened for 1 round. When the wielder uses the weapon to knock unconscious or kill a creature, he gains 5 temporary hit points that last for 10 minutes.";
            var temp_hp_buff = Helpers.CreateBuff("CruelTemporaryHpBuff",
                                                  "Cruel Enchantmnet Temporary HP Bonus",
                                                  description,
                                                  "",
                                                  Helpers.GetIcon("e5cb4c4459e437e49a4cd73fde6b9063"), //inflict light wounds
                                                  null,
                                                  Helpers.Create <TemporaryHitPointsFromAbilityValue>(t => { t.Value = 5; t.RemoveWhenHitPointsEnd = true; })
                                                  );


            var sickened       = library.Get <BlueprintBuff>("4e42460798665fd4cb9173ffa7ada323");
            var apply_tmp_hp   = Common.createContextActionApplyBuff(temp_hp_buff, Helpers.CreateContextDuration(10, Kingmaker.UnitLogic.Mechanics.DurationRate.Minutes), dispellable: false);
            var apply_sickened = Helpers.CreateConditionalOr(new Condition[] { Helpers.Create <NewMechanics.ContextConditionHasCondition>(c => c.condition = UnitCondition.Frightened),
                                                                               Helpers.Create <NewMechanics.ContextConditionHasCondition>(c => c.condition = UnitCondition.Shaken) },
                                                             Common.createContextActionApplyBuff(sickened, Helpers.CreateContextDuration(1), dispellable: false)
                                                             );


            cruel = Common.createWeaponEnchantment("CruelWeaponEnchantment",
                                                   "Cruel",
                                                   description,
                                                   "",
                                                   "",
                                                   "",
                                                   5,
                                                   null,
                                                   Common.createAddInitiatorAttackWithWeaponTrigger(Helpers.CreateActionList(apply_sickened), wait_for_attack_to_resolve: true),
                                                   Common.createAddInitiatorAttackWithWeaponTrigger(Helpers.CreateActionList(apply_tmp_hp), wait_for_attack_to_resolve: true,
                                                                                                    on_initiator: true, reduce_hp_to_zero: true)
                                                   );
        }
コード例 #2
0
        static void createMenacingEnchant()
        {
            var icon          = Helpers.GetIcon("9b9eac6709e1c084cb18c3a366e0ec87");
            var menacing_buff = Helpers.CreateBuff("MenacingEncahntBuff",
                                                   "Menacing",
                                                   "",
                                                   "",
                                                   icon,
                                                   null,
                                                   Helpers.Create <NewMechanics.EnchantmentMechanics.Menaced>());

            menacing_buff.SetBuffFlags(BuffFlags.HiddenInUi);
            var aura = Common.createAuraEffectFeature("Menacing",
                                                      "A menacing weapon helps allies deal with flanked foes. When the wielder is adjacent to a creature that is being flanked by an ally, the flanking bonus on attack rolls for all flanking allies increases by +2. This ability works even if the wielder is not one of the characters flanking the creature.",
                                                      icon,
                                                      menacing_buff,
                                                      7.Feet(),
                                                      Helpers.CreateConditionsCheckerAnd(Helpers.Create <ContextConditionIsEnemy>())
                                                      );



            menacing = Common.createWeaponEnchantment("MencaingWeaponEnchantment",
                                                      aura.Name,
                                                      aura.Description,
                                                      "",
                                                      "",
                                                      "",
                                                      5,
                                                      null,
                                                      Helpers.Create <AddUnitFeatureEquipment>(a => a.Feature = aura)
                                                      );
        }
コード例 #3
0
 static void createHeartSeekerEnchant()
 {
     heartseeker = Common.createWeaponEnchantment("HeartSeekerWeaponEnchantment",
                                                  "Heartseeker",
                                                  "A heartseeker weapon is drawn unerringly toward beating hearts. A heartseeker weapon ignores the miss chance for concealment against most living targets, though the attack must still target the proper square. This special ability does not apply against aberrations, oozes, plants, outsiders with the elemental subtype, or any creature specifically noted to lack a heart.",
                                                  "",
                                                  "",
                                                  "",
                                                  5,
                                                  null,
                                                  Helpers.Create <NewMechanics.EnchantmentMechanics.HeartSeekerEnchantment>()
                                                  );
 }
コード例 #4
0
        static public void initialize()
        {
            createMetamagicEnchantments();
            createSummonedWeaponEnchantment();
            createStaticEnchants();
            //fix weapon enchants to be non cumulative
            fixEnchants();

            createCruelEnchant();
            createHeartSeekerEnchant();
            createMenacingEnchant();
            createVorpalEnchant();

            var brilliant_energy = library.Get <BlueprintWeaponEnchantment>("6cbb732b9d638724a960d784634dcdcf"); //plasma

            dazzling_blade_fx_enchant = Common.createWeaponEnchantment("DazzlingWeaponEnchant", "", "", "", "", "", 0, brilliant_energy.WeaponFxPrefab);
        }
コード例 #5
0
        static void createVorpalEnchant()
        {
            var action = Helpers.CreateConditional(Common.createContextConditionHasFacts(false, Common.undead, Common.plant, Common.aberration, Common.construct, Common.elemental),
                                                   null,
                                                   Helpers.Create <ContextActionKillTarget>()
                                                   );

            vorpal = Common.createWeaponEnchantment("VorpalWeaponEnchantment",
                                                    "Vorpal",
                                                    "This potent and feared ability allows the weapon to sever the heads of those it strikes.\n"
                                                    + "Upon a roll of natural 20 (followed by a successful roll to confirm the critical hit), the weapon severs the opponent’s head (if it has one) from its body. Some creatures, such as many aberrations and all oozes, have no heads. Others, such as golems and undead creatures other than vampires, are not affected by the loss of their heads. Most other creatures, however, die when their heads are cut off.",
                                                    "",
                                                    "",
                                                    "",
                                                    5,
                                                    null,
                                                    Common.createAddInitiatorAttackRollTrigger2(Helpers.CreateActionList(action), critical_hit: true, only_natural20: true)
                                                    );
        }
        static void createMetamagicEnchantments()
        {
            empower_enchant = Common.createWeaponEnchantment("EmpowerWeaponEnchantment",
                                                             "Empowered",
                                                             "All variable, numeric effects of an empowered spell are increased by half including bonuses to those dice rolls.",
                                                             "",
                                                             "",
                                                             "",
                                                             0,
                                                             null,
                                                             Helpers.Create <NewMechanics.EnchantmentMechanics.WeaponMetamagicDamage>(w => w.empower = true)
                                                             );
            maximize_enchant = Common.createWeaponEnchantment("MaximizeWeaponEnchantment",
                                                              "Maximized",
                                                              "All variable, numeric effects of a spell are maximized.",
                                                              "",
                                                              "",
                                                              "",
                                                              0,
                                                              null,
                                                              Helpers.Create <NewMechanics.EnchantmentMechanics.WeaponMetamagicDamage>(w => w.maximize = true)
                                                              );

            DamageEnergyType[] elements = new DamageEnergyType[] { DamageEnergyType.Cold, DamageEnergyType.Acid, DamageEnergyType.Electricity, DamageEnergyType.Fire };

            foreach (var elt  in elements)
            {
                var enchant = Common.createWeaponEnchantment(elt.ToString() + "ElementalWeaponEnchantment",
                                                             elt.ToString(),
                                                             "Weapon damage type is changed to " + elt.ToString().ToLower() + ".",
                                                             "",
                                                             "",
                                                             "",
                                                             0,
                                                             null,
                                                             Helpers.Create <NewMechanics.EnchantmentMechanics.ReplaceEnergyDamage>(r => r.energy_descriptor = elt)
                                                             );
                elemental_enchants.Add(elt, enchant);
            }
        }
        static void createSummonedWeaponEnchantment()
        {
            summoned_weapon_enchant = Common.createWeaponEnchantment("SummonedWeaponEnchant",
                                                                     "Summoned",
                                                                     "This is a summoned weapon.",
                                                                     "",
                                                                     "",
                                                                     "",
                                                                     0,
                                                                     null
                                                                     );

            BlueprintWeaponType[] kinetic_blade_types = new BlueprintWeaponType[] { library.Get <BlueprintWeaponType>("b05a206f6c1133a469b2f7e30dc970ef"),
                                                                                    library.Get <BlueprintWeaponType>("a15b2fb1d5dc4f247882a7148d50afb0") };
            //add it to kinetic blades
            var kinetic_blades = library.GetAllBlueprints().OfType <BlueprintItemWeapon>().Where(w => kinetic_blade_types.Contains(w.Type));

            foreach (var kb in kinetic_blades)
            {
                Common.addEnchantment(kb, summoned_weapon_enchant);
            }
        }
コード例 #8
0
 static void createMetamagicEnchantments()
 {
     empower_enchant = Common.createWeaponEnchantment("EmpowerWeaponEnchantment",
                                                      "Empowered",
                                                      "All variable, numeric effects of an empowered spell are increased by half including bonuses to those dice rolls.",
                                                      "",
                                                      "",
                                                      "",
                                                      0,
                                                      null,
                                                      Helpers.Create <NewMechanics.EnchantmentMechanics.WeaponMetamagicDamage>(w => w.empower = true)
                                                      );
     maximize_enchant = Common.createWeaponEnchantment("MaximizeWeaponEnchantment",
                                                       "Maximized",
                                                       "All variable, numeric effects of a spell are maximized.",
                                                       "",
                                                       "",
                                                       "",
                                                       0,
                                                       null,
                                                       Helpers.Create <NewMechanics.EnchantmentMechanics.WeaponMetamagicDamage>(w => w.maximize = true)
                                                       );
 }
コード例 #9
0
        public void Load()
        {
            var library = Main.library;

            // For some reason, Eldritch Scion is a class and an archetype.
            const string eldritchScionClassId = "f5b8c63b141b2f44cbb8c2d7579c34f5";

            classes = library.Root.Progression.CharacterClasses.Where(c => c.AssetGuid != eldritchScionClassId)
                      .ToList();
            prestigeClasses        = classes.Where(c => c.PrestigeClass).ToList();
            sorcererClass          = GetClass("b3a505fb61437dc4097f43c3f8f9a4cf");
            magusClass             = GetClass("45a4607686d96a1498891b3286121780");
            dragonDiscipleClass    = GetClass("72051275b1dbb2d42ba9118237794f7c");
            eldritchScionArchetype =
                magusClass.Archetypes.First(a => a.AssetGuid == "d078b2ef073f2814c9e338a789d97b73");

            human    = library.Get <BlueprintRace>("0a5d473ead98b0646b94495af250fdc4");
            halfElf  = library.Get <BlueprintRace>("b3646842ffbd01643ab4dac7479b20b0");
            halfOrc  = library.Get <BlueprintRace>("1dc20e195581a804890ddc74218bfd8e");
            elf      = library.Get <BlueprintRace>("25a5878d125338244896ebd3238226c8");
            dwarf    = library.Get <BlueprintRace>("c4faf439f0e70bd40b5e36ee80d06be7");
            halfling = library.Get <BlueprintRace>("b0c3ef2729c498f47970bb50fa1acd30");
            gnome    = library.Get <BlueprintRace>("ef35a22c9a27da345a4528f0d5889157");
            aasimar  = library.Get <BlueprintRace>("b7f02ba92b363064fb873963bec275ee");
            tiefling = library.Get <BlueprintRace>("5c4e42124dc2b4647af6e36cf2590500");

            races          = new[] { human, halfElf, halfOrc, elf, dwarf, halfling, gnome, aasimar, tiefling };
            skillFocusFeat = library.Get <BlueprintFeatureSelection>("c9629ef9eebb88b479b2fbc5e836656a");

            tenMinPerLevelDuration =
                library.Get <BlueprintAbility>("5b77d7cc65b8ab74688e74a37fc2f553").LocalizedDuration;    // barkskin
            minutesPerLevelDuration =
                library.Get <BlueprintAbility>("ef768022b0785eb43a18969903c537c4").LocalizedDuration;    // shield
            hourPerLevelDuration =
                library.Get <BlueprintAbility>("9e1ad5d6f87d19e4d8883d63a6e35568").LocalizedDuration;    // mage armor
            roundsPerLevelDuration =
                library.Get <BlueprintAbility>("486eaff58293f6441a5c2759c4872f98").LocalizedDuration;    // haste
            oneRoundDuration =
                library.Get <BlueprintAbility>("2c38da66e5a599347ac95b3294acbe00").LocalizedDuration;    // true strike
            reflexHalfDamage =
                library.Get <BlueprintAbility>("2d81362af43aeac4387a3d4fced489c3").LocalizedSavingThrow; // fireball
            savingThrowNone =
                library.Get <BlueprintAbility>("4ac47ddb9fa1eaf43a1b6809980cfbd2").LocalizedSavingThrow; // magic missle

            wizardSpellList     = library.Get <BlueprintSpellList>("ba0401fdeb4062f40a7aa95b6f07fe89");
            magusSpellList      = library.Get <BlueprintSpellList>("4d72e1e7bd6bc4f4caaea7aa43a14639");
            druidSpellList      = library.Get <BlueprintSpellList>("bad8638d40639d04fa2f80a1cac67d6b");
            clericSpellList     = library.Get <BlueprintSpellList>("8443ce803d2d31347897a3d85cc32f53");
            paladinSpellList    = library.Get <BlueprintSpellList>("9f5be2f7ea64fe04eb40878347b147bc");
            inquisitorSpellList = library.Get <BlueprintSpellList>("57c894665b7895c499b3dce058c284b3");
            alchemistSpellList  = library.Get <BlueprintSpellList>("f60d0cd93edc65c42ad31e34a905fb2f");
            bardSpellList       = library.Get <BlueprintSpellList>("25a5013493bdcf74bb2424532214d0c8");

            touchWeapon = library.Get <BlueprintItemWeapon>("bb337517547de1a4189518d404ec49d4"); // TouchItem

            bloodlineSelection = library.Get <BlueprintFeatureSelection>("24bef8d1bee12274686f6da6ccbc8914");

            ghostTouch = library.Get <BlueprintWeaponEnchantment>("47857e1a5a3ec1a46adf6491b1423b4f");

            // Note: we can't easily scan all class spell lists, because some spells are
            // only added via special lists, like the ice version of burning hands.
            foreach (var blueprint in Main.library.GetAllBlueprints())
            {
                switch (blueprint)
                {
                case BlueprintAbility spell when spell.Type == AbilityType.Spell:
                    // Tiefling racial SLAs are marked as spells rather than SLAs.
                    // (We can find them by the presence of the resource logic.)
                    if (spell.GetComponent <AbilityResourceLogic>() != null)
                    {
                        spellsWithResources.Add(spell);
                    }
                    else
                    {
                        allSpells.Add(spell);
                    }
                    break;

                case BlueprintLoot loot:
                    allLoots.Add(loot);
                    break;

                case BlueprintUnitLoot unitLoot:
                    allUnitLoots.Add(unitLoot);
                    break;
                }
            }

            BlueprintCharacterClass GetClass(String assetId) => classes.First(c => c.AssetGuid == assetId);
        }
コード例 #10
0
        public BlueprintFeature createPhilosophersTouch()
        {
            var icon = LoadIcons.Image2Sprite.Create(@"AbilityIcons/WeaponMagic.png");
            List <BlueprintAbility> abilities_single   = new List <BlueprintAbility>();
            List <BlueprintAbility> abilities_multiple = new List <BlueprintAbility>();
            var enchants = new BlueprintWeaponEnchantment[]
            {
                WeaponEnchantments.cold_iron,
                WeaponEnchantments.mithral,
                WeaponEnchantments.adamantine
            };

            var remove_buffs = Helpers.Create <NewMechanics.ContextActionRemoveBuffs>(c => c.Buffs = new BlueprintBuff[0]);

            foreach (var e in enchants)
            {
                var buff = Helpers.CreateBuff(prefix + e.name + "PhilosophersTouchBuff",
                                              "Philosopher’s Touch: " + e.Name,
                                              "As a standard action, you can expend 1 point of mental focus and touch a weapon, causing it to gain the properties of a special material. You can cause the weapon to be treated as cold iron or silver for the purposes of overcoming damage reduction for 1 minute per occultist level you possess.\n"
                                              + "At 8th level, you can affect all weapons in 15-foot burst centered on you (still expending only 1 point of mental focus). At 11th level, you can cause any weapon affected by this ability to act as if it were adamantine instead.",
                                              "",
                                              icon,
                                              null,
                                              Helpers.Create <NewMechanics.EnchantmentMechanics.PersistentWeaponEnchantment>(p => { p.secondary_hand = false; p.only_melee = true; p.enchant = e; })
                                              );
                remove_buffs.Buffs = remove_buffs.Buffs.AddToArray(buff);
                var ability_single = Helpers.CreateAbility(prefix + e.name + "PhilosophersTouchSingleAbility",
                                                           buff.Name,
                                                           buff.Description,
                                                           "",
                                                           buff.Icon,
                                                           AbilityType.Supernatural,
                                                           CommandType.Standard,
                                                           AbilityRange.Touch,
                                                           Helpers.minutesPerLevelDuration,
                                                           "",
                                                           Helpers.CreateRunActions(remove_buffs, Common.createContextActionApplyBuff(buff, Helpers.CreateContextDuration(Helpers.CreateContextValue(AbilityRankType.Default), DurationRate.Minutes), dispellable: false)),
                                                           Common.createAbilitySpawnFx("352469f228a3b1f4cb269c7ab0409b8e", anchor: AbilitySpawnFxAnchor.SelectedTarget),
                                                           resource.CreateResourceLogic(),
                                                           createClassScalingConfig()
                                                           );
                ability_single.setMiscAbilityParametersTouchFriendly();
                if (e == WeaponEnchantments.adamantine)
                {
                    ability_single.AddComponent(Helpers.Create <NewMechanics.AbilityShowIfHasClassLevels>(a => { a.character_classes = classes; a.level = 11; }));
                }

                var ability_multiple = library.CopyAndAdd(ability_single, prefix + e.name + "PhilosophersTouchSingleMultiple", "");
                ability_multiple.Range = AbilityRange.Personal;
                ability_multiple.AddComponent(Helpers.CreateAbilityTargetsAround(15.Feet(), TargetType.Ally));

                abilities_single.Add(ability_single);
                abilities_multiple.Add(ability_multiple);
            }


            var wrapper_single = Common.createVariantWrapper(prefix + "PhilosophersTouchSingleAbilityBase", "", abilities_single.ToArray());

            wrapper_single.SetName("Philosopher’s Touch");
            var wrapper_multiple = Common.createVariantWrapper(prefix + "PhilosophersTouchMultipleAbilityBase", "", abilities_multiple.ToArray());

            wrapper_multiple.SetName("Philosopher’s Touch");

            addFocusInvestmentCheck(wrapper_single, SpellSchool.Transmutation);
            addFocusInvestmentCheck(wrapper_multiple, SpellSchool.Transmutation);
            var feature_single   = Common.AbilityToFeature(wrapper_single);
            var feature_multiple = Common.AbilityToFeature(wrapper_multiple);

            var feature = Helpers.CreateFeature(prefix + "PhilosophersTouchFeature",
                                                feature_single.Name,
                                                feature_single.Description,
                                                "",
                                                feature_single.Icon,
                                                FeatureGroup.None,
                                                createAddFeatureInLevelRange(feature_single, 0, 7),
                                                createAddFeatureInLevelRange(feature_multiple, 8, 100)
                                                );

            return(feature);
        }
コード例 #11
0
        public static void PatchItem <T>(FileInfo file, BlueprintScriptableObject blueprintScriptableObject, string guid)
        {
            Common.ModLoggerDebug($"{guid} -> {blueprintScriptableObject} ({blueprintScriptableObject.GetType()})");

            T   jsonItem  = DeserialiseItem <T>(file);
            var blueprint = Convert.ChangeType(blueprintScriptableObject, blueprintScriptableObject.GetType());

            foreach (PropertyInfo property in jsonItem.GetType().GetProperties())
            {
                if (property.Name == "m_BaseDamage" && Traverse.Create(jsonItem).Property("m_BaseDamage").GetValue() != null)
                {
                    ModifiedDiceFormula dice        = (ModifiedDiceFormula)property.GetValue(jsonItem);
                    DiceFormula         diceFormula = new DiceFormula((int)dice.m_Rolls, (DiceType)dice.m_Dice);
                    Traverse.Create(blueprint).Field("m_BaseDamage").SetValue(diceFormula);

                    Common.ModLoggerDebug($"{blueprint} m_BaseDamage set to {diceFormula}.");
                }
                else if (property.Name == "m_DamageDice" && Traverse.Create(jsonItem).Property("m_DamageDice").GetValue() != null)
                {
                    ModifiedDiceFormula dice        = (ModifiedDiceFormula)property.GetValue(jsonItem);
                    DiceFormula         diceFormula = new DiceFormula((int)dice.m_Rolls, (DiceType)dice.m_Dice);
                    Traverse.Create(blueprint).Field("m_DamageDice").SetValue(diceFormula);

                    Common.ModLoggerDebug($"{blueprint} m_DamageDice set to {diceFormula}.");
                }
                else if (property.Name == "m_Enchantments" && Traverse.Create(jsonItem).Property("m_Enchantments").GetValue() != null)
                {
                    if (typeof(T) == typeof(EnchantableEquipment))
                    {
                        string[] enchantmentsGUIDS = (string[])Traverse.Create(jsonItem).Property("m_Enchantments").GetValue();
                        BlueprintEquipmentEnchantment[] enchantmentsBlueprints = new BlueprintEquipmentEnchantment[enchantmentsGUIDS.Length];
                        for (int i = 0; i < enchantmentsGUIDS.Length; i++)
                        {
                            string enchantmentGUID = CleanEnchantment(enchantmentsGUIDS[i]);
                            enchantmentsBlueprints[i] = (BlueprintEquipmentEnchantment)Utilities.GetBlueprintByGuid <BlueprintEquipmentEnchantment>(enchantmentGUID);
                        }

                        Traverse.Create(blueprint).Field("m_Enchantments").SetValue(enchantmentsBlueprints);

                        Common.ModLoggerDebug($"{blueprint} m_Enchantments set to {enchantmentsBlueprints}.");
                    }
                    else if (typeof(T) == typeof(ModifiedWeapon))
                    {
                        string[] enchantmentsGUIDS = (string[])Traverse.Create(jsonItem).Property("m_Enchantments").GetValue();
                        BlueprintWeaponEnchantment[] enchantmentsBlueprints = new BlueprintWeaponEnchantment[enchantmentsGUIDS.Length];
                        for (int i = 0; i < enchantmentsGUIDS.Length; i++)
                        {
                            string enchantmentGUID = CleanEnchantment(enchantmentsGUIDS[i]);
                            enchantmentsBlueprints[i] = (BlueprintWeaponEnchantment)Utilities.GetBlueprintByGuid <BlueprintWeaponEnchantment>(enchantmentGUID);
                        }
                        Traverse.Create(blueprint).Field("m_Enchantments").SetValue(enchantmentsBlueprints);

                        Common.ModLoggerDebug($"{blueprint} m_Enchantments set to {enchantmentsBlueprints}.");
                    }
                }
                else
                {
                    SetBlueprintField(blueprint, jsonItem, property.Name);
                }
            }
        }
コード例 #12
0
        static void createFlameBlade()
        {
            var bless_weapon       = library.Get <BlueprintAbility>("831e942864e924846a30d2e0678e438b");
            var flaming_enchatment = library.Get <BlueprintWeaponEnchantment>("30f90becaaac51f41bf56641966c4121");
            var scimitar_type      = library.Get <BlueprintWeaponType>("d9fbec4637d71bd4ebc977628de3daf3");
            var immaterial         = Helpers.Create <NewMechanics.Immaterial>();

            BlueprintWeaponEnchantment[] flame_blade_enchantments = new BlueprintWeaponEnchantment[11];
            var fire_damage = Common.createEnergyDamageDescription(Kingmaker.Enums.Damage.DamageEnergyType.Fire);

            for (int i = 0; i < flame_blade_enchantments.Length; i++)
            {
                var flame_blade_enchant = Helpers.Create <NewMechanics.WeaponDamageChange>(w =>
                {
                    w.bonus_damage            = i;
                    w.dice_formula            = new DiceFormula(1, DiceType.D8);
                    w.damage_type_description = fire_damage;
                });
                flame_blade_enchantments[i] = Common.createWeaponEnchantment($"FlameBlade{i}Enchantment",
                                                                             "Flame Blade",
                                                                             "You transform a non-magical scimitar into a 3-foot-long, blazing beam of red-hot fire springs. Attacks with the flame blade are melee touch attacks. The blade deals 1d8 points of fire damage + 1 point per two caster levels (maximum +10). Since the blade is immaterial, your Strength modifier does not apply to the damage. If you stop wielding it, the weapon loses magical properties.",
                                                                             "",
                                                                             "",
                                                                             "",
                                                                             0,
                                                                             flaming_enchatment.WeaponFxPrefab,
                                                                             immaterial,
                                                                             flame_blade_enchant
                                                                             );
            }


            var empower = Common.createWeaponEnchantment("EmpowerWeaponEnchantment",
                                                         "Empowered",
                                                         "All variable, numeric effects of an empowered spell are increased by half including bonuses to those dice rolls.",
                                                         "",
                                                         "",
                                                         "",
                                                         0,
                                                         null,
                                                         Helpers.Create <NewMechanics.WeaponMetamagicDamage>(w => w.empower = true)
                                                         );
            var maximize = Common.createWeaponEnchantment("MaximizeWeaponEnchantment",
                                                          "Maximized",
                                                          "All variable, numeric effects of a spell are maximized.",
                                                          "",
                                                          "",
                                                          "",
                                                          0,
                                                          null,
                                                          Helpers.Create <NewMechanics.WeaponMetamagicDamage>(w => w.maximize = true)
                                                          );


            var empower_buff = Common.createBuffContextEnchantPrimaryHandWeaponIfHasMetamagic(Kingmaker.UnitLogic.Abilities.Metamagic.Empower,
                                                                                              true, true,
                                                                                              new BlueprintWeaponType[] { scimitar_type }, empower);

            var maximize_buff = Common.createBuffContextEnchantPrimaryHandWeaponIfHasMetamagic(Kingmaker.UnitLogic.Abilities.Metamagic.Maximize,
                                                                                               true, true,
                                                                                               new BlueprintWeaponType[] { scimitar_type }, maximize);


            var buff = Helpers.CreateBuff("FlameBladeBuff",
                                          flame_blade_enchantments[0].Name,
                                          flame_blade_enchantments[0].Description,
                                          "",
                                          bless_weapon.Icon,
                                          null,
                                          Common.createBuffContextEnchantPrimaryHandWeapon(Helpers.CreateContextValue(AbilityRankType.DamageBonus), true, true,
                                                                                           new BlueprintWeaponType[] { scimitar_type }, flame_blade_enchantments),
                                          empower_buff,
                                          maximize_buff,
                                          Helpers.CreateContextRankConfig(baseValueType: ContextRankBaseValueType.CasterLevel, progression: ContextRankProgression.OnePlusDivStep,
                                                                          type: AbilityRankType.DamageBonus, stepLevel: 2)
                                          );

            buff.Stacking = Kingmaker.UnitLogic.Buffs.Blueprints.StackingType.Replace;

            flame_blade = library.CopyAndAdd <BlueprintAbility>(shillelagh.AssetGuid, "FlameBladeAbility", "");
            flame_blade.SetIcon(bless_weapon.Icon);
            flame_blade.SetName(buff.Name);
            flame_blade.SetDescription(buff.Description);

            flame_blade.ReplaceComponent <AbilityCasterMainWeaponCheck>(Common.createAbilityCasterMainWeaponCheck(scimitar_type.Category));
            flame_blade.ReplaceComponent <SpellComponent>(Helpers.CreateSpellComponent(Kingmaker.Blueprints.Classes.Spells.SpellSchool.Evocation));

            var apply_buff = Common.createContextActionApplyBuff(buff,
                                                                 Helpers.CreateContextDuration(Helpers.CreateContextValue(AbilityRankType.Default), DurationRate.Minutes)
                                                                 );

            flame_blade.ReplaceComponent <AbilityEffectRunAction>(Helpers.CreateRunActions(apply_buff));
            flame_blade.AvailableMetamagic = flame_blade.AvailableMetamagic | Kingmaker.UnitLogic.Abilities.Metamagic.Empower | Kingmaker.UnitLogic.Abilities.Metamagic.Maximize;
            flame_blade.AddComponent(Helpers.CreateSpellDescriptor(SpellDescriptor.Fire));

            flame_blade.AddToSpellList(Helpers.druidSpellList, 2);
            flame_blade.AddSpellAndScroll("fbdd06f0414c3ef458eb4b2a8072e502"); //bless weapon
        }
コード例 #13
0
        static void createSpellStoring()
        {
            var store_feature = Helpers.CreateFeature("CharacterWeaponSpellStroingFeature",
                                                      "",
                                                      "",
                                                      "",
                                                      null,
                                                      Kingmaker.Blueprints.Classes.FeatureGroup.None,
                                                      Helpers.Create <SpellManipulationMechanics.FactStoreSpell>(f => f.link_type = SpellManipulationMechanics.FactStoreSpell.LinkType.Weapon)
                                                      );

            store_feature.HideInCharacterSheetAndLevelUp = true;
            store_feature.HideInUI = true;

            var basic_feat_progression = ResourcesLibrary.TryGetBlueprint <BlueprintProgression>("5b72dd2ca2cb73b49903806ee8986325");

            basic_feat_progression.LevelEntries[0].Features.Add(store_feature);

            Action <UnitDescriptor> save_game_action = delegate(UnitDescriptor u)
            {
                if (!u.HasFact(store_feature))
                {
                    u.AddFact(store_feature);
                }
            };

            SaveGameFix.save_game_actions.Add(save_game_action);
            spell_storing_feature = store_feature;
            var icon    = Helpers.GetIcon("a26c23a887a6f154491dc2cefdad2c35"); //crusader's edge
            var feature = Helpers.CreateFeature("WeaponSpellStoringFeature",
                                                "Spell Storing Weapon",
                                                "A spell storing weapon allows a spellcaster to store a single targeted spell of up to 3rd level in the weapon. (The spell must have a casting time of 1 standard action.) Anytime the weapon strikes a creature and the creature takes damage from it, the weapon can immediately cast the spell on that creature as a free action if the wielder desires. (This special ability is an exception to the general rule that casting a spell from an item takes at least as long as casting that spell normally.) Once the spell has been cast from the weapon, a spellcaster can cast any other targeted spell of up to 3rd level into it.",
                                                "",
                                                icon,
                                                Kingmaker.Blueprints.Classes.FeatureGroup.None);

            var release_buff = Helpers.CreateBuff("WeaponSpellStoringToggleBuff",
                                                  feature.Name + ": Release",
                                                  feature.Description,
                                                  "",
                                                  feature.Icon,
                                                  null,
                                                  Helpers.Create <SpellManipulationMechanics.AddStoredSpellToCaption>(a => a.store_fact = store_feature));

            var major_activatable_ability = Helpers.CreateActivatableAbility("WeaponSpellStoringToggleAbility",
                                                                             feature.Name + ": Release",
                                                                             feature.Description,
                                                                             "",
                                                                             feature.Icon,
                                                                             release_buff,
                                                                             AbilityActivationType.Immediately,
                                                                             CommandType.Free,
                                                                             null,
                                                                             Helpers.Create <SpellManipulationMechanics.ActivatableAbilitySpellStoredInFactRestriction>(a => a.fact = store_feature));

            major_activatable_ability.DeactivateImmediately = true;

            var release_action       = Helpers.Create <SpellManipulationMechanics.ReleaseSpellStoredInSpecifiedBuff>(r => r.fact = store_feature);
            var release_on_condition = Helpers.CreateConditional(Common.createContextConditionCasterHasFact(release_buff), release_action);

            feature.AddComponent(Common.createAddInitiatorAttackWithWeaponTrigger(action: Helpers.CreateActionList(release_on_condition), wait_for_attack_to_resolve: true));
            feature.AddComponent(Helpers.CreateAddFact(major_activatable_ability));

            int max_variants = 10; //due to ui limitation
            Predicate <AbilityData> check_slot_predicate = delegate(AbilityData spell)
            {
                return(spell.SpellLevel <= 3 &&
                       spell.Blueprint.EffectOnEnemy == AbilityEffectOnUnit.Harmful &&
                       spell.Blueprint.Range != AbilityRange.Personal &&
                       spell.Blueprint.CanTargetEnemies &&
                       !spell.Blueprint.CanTargetPoint &&
                       !spell.Blueprint.IsFullRoundAction &&
                       (!spell.Blueprint.HasVariants || spell.Variants.Count < max_variants) &&
                       !spell.Blueprint.HasAreaEffect() &&
                       (!spell.RequireMaterialComponent || spell.HasEnoughMaterialComponent));
            };

            for (int i = 0; i < max_variants; i++)
            {
                var ability = Helpers.CreateAbility($"WeaponSpellStoring{i + 1}Ability",
                                                    feature.Name,
                                                    feature.Description,
                                                    "",
                                                    feature.Icon,
                                                    AbilityType.Supernatural,
                                                    CommandType.Standard,
                                                    AbilityRange.Personal,
                                                    "",
                                                    "",
                                                    Helpers.Create <SpellManipulationMechanics.AbilityStoreSpellInFact>(s => { s.fact = store_feature; s.check_slot_predicate = check_slot_predicate; s.variant = i; })
                                                    );
                ability.setMiscAbilityParametersSelfOnly();
                feature.AddComponent(Helpers.CreateAddFact(ability));
            }

            spell_storing = Common.createWeaponEnchantment("SpellStoringWeaponEnchantment",
                                                           "Spell Storing",
                                                           feature.Description,
                                                           "",
                                                           "",
                                                           "",
                                                           0,
                                                           1,
                                                           null,
                                                           Helpers.Create <AddUnitFeatureEquipment>(a => a.Feature = feature)
                                                           );
        }