internal static void giveDifficultTerrainImmunityToAirborneUnits() { var airborne = library.Get <BlueprintFeature>("70cffb448c132fa409e49156d013b175"); airborne.AddComponent(Common.createAddConditionImmunity(Kingmaker.UnitLogic.UnitCondition.DifficultTerrain)); airborne.AddComponent(Common.createBuffDescriptorImmunity(Kingmaker.Blueprints.Classes.Spells.SpellDescriptor.Ground)); airborne.AddComponent(Common.createSpellImmunityToSpellDescriptor(Kingmaker.Blueprints.Classes.Spells.SpellDescriptor.Ground)); var air_mastery = library.Get <BlueprintFeature>("be52ced7ae1c7354a8ee12d9bad47805"); BlueprintUnitFact[] facts = new BlueprintUnitFact[] { library.Get <BlueprintBuff>("3689b69a30d6d7c48b90e28228fb7b7c"), //transmuter air elemental 1 library.Get <BlueprintBuff>("2b2060036a20108448299f3ee2b14015"), //transmuter air elemental 2 library.Get <BlueprintBuff>("2641f73f8d7864f4bba0bd6134018094"), //polymorph air elemental greater library.Get <BlueprintBuff>("933c5cd1113d2ef4a84f55660a744008"), //polymorph air elemental library.Get <BlueprintBuff>("70828d40058f2d3428bb767eb6e3e561"), //air elemental body 1 library.Get <BlueprintBuff>("3af4d4bc55fa0ae4e851708d7395f1dd"), //air elemental body 2 library.Get <BlueprintBuff>("db00581a03e6947419648dfba6aa03b2"), //air elemental body 3 library.Get <BlueprintBuff>("ba06b8cff52da9e4d8432144ed6a6d19"), //air elemental body 4 library.Get <BlueprintBuff>("dc1ef6f6d52b9fd49bc0696ab1a4f18b"), //air wildshape 1 library.Get <BlueprintBuff>("65fdf187fea97c94b9cf4ff6746901a6"), //air wildshape 2 library.Get <BlueprintBuff>("814bc75e74f969641bf110addf076ff9"), //air wildshape 3 library.Get <BlueprintBuff>("eb52d24d6f60fc742b32fe943b919180"), //air wildshape 4 library.Get <BlueprintBuff>("1a482859d9513e4418f57abcd396d315"), //wyvern }; for (int i = 0; i < facts.Length; i++) { facts[i].AddComponent(Helpers.CreateAddFact(airborne)); if (i < 12) { facts[i].AddComponent(Helpers.CreateAddFact(air_mastery)); } } var airborne_types = new BlueprintUnitType[] { library.Get <BlueprintUnitType>("b012216cc6867354fb088d0c36968ea3"), //black dragon library.Get <BlueprintUnitType>("f52b75839bb928242b6108df9d7f35a2"), //wyvern library.Get <BlueprintUnitType>("284b6fd0b67688a4bb3ec28b15152d69"), //ankou library.Get <BlueprintUnitType>("a574fa56e67623d41b538bdeae291fd5"), //gargoyle library.Get <BlueprintUnitType>("535823c600a2c8f4a906063b7b949eb5") //jabberwok }; var units = library.GetAllBlueprints().OfType <BlueprintUnit>(); foreach (var unit in units) { if (airborne_types.Contains(unit.Type)) { unit.AddFacts = unit.AddFacts.AddToArray(airborne); } } }
static void fixFlyingCreatures() { airborne.AddComponent(Common.createAddConditionImmunity(Kingmaker.UnitLogic.UnitCondition.DifficultTerrain)); airborne.AddComponent(Common.createBuffDescriptorImmunity(Kingmaker.Blueprints.Classes.Spells.SpellDescriptor.Ground)); airborne.AddComponent(Common.createSpellImmunityToSpellDescriptor(Kingmaker.Blueprints.Classes.Spells.SpellDescriptor.Ground)); airborne.AddComponent(Helpers.Create <AddFlying>()); airborne.AddComponent(Helpers.Create <ManeuverImmunity>(m => m.Type = CombatManeuver.Trip)); airborne.RemoveComponents <DamageBonusConditional>(); airborne.RemoveComponents <AttackBonusConditional>(); BlueprintUnitFact[] facts = new BlueprintUnitFact[] { library.Get <BlueprintBuff>("3689b69a30d6d7c48b90e28228fb7b7c"), //transmuter air elemental 1 library.Get <BlueprintBuff>("2b2060036a20108448299f3ee2b14015"), //transmuter air elemental 2 library.Get <BlueprintBuff>("2641f73f8d7864f4bba0bd6134018094"), //polymorph air elemental greater library.Get <BlueprintBuff>("933c5cd1113d2ef4a84f55660a744008"), //polymorph air elemental library.Get <BlueprintBuff>("70828d40058f2d3428bb767eb6e3e561"), //air elemental body 1 library.Get <BlueprintBuff>("3af4d4bc55fa0ae4e851708d7395f1dd"), //air elemental body 2 library.Get <BlueprintBuff>("db00581a03e6947419648dfba6aa03b2"), //air elemental body 3 library.Get <BlueprintBuff>("ba06b8cff52da9e4d8432144ed6a6d19"), //air elemental body 4 library.Get <BlueprintBuff>("dc1ef6f6d52b9fd49bc0696ab1a4f18b"), //air wildshape 1 library.Get <BlueprintBuff>("65fdf187fea97c94b9cf4ff6746901a6"), //air wildshape 2 library.Get <BlueprintBuff>("814bc75e74f969641bf110addf076ff9"), //air wildshape 3 library.Get <BlueprintBuff>("eb52d24d6f60fc742b32fe943b919180"), //air wildshape 4 library.Get <BlueprintBuff>("1a482859d9513e4418f57abcd396d315"), //wyvern library.Get <BlueprintBuff>("268fafac0a5b78c42a58bd9c1ae78bcf"), //black dragon I library.Get <BlueprintBuff>("b117bc8b41735924dba3fb23318f39ff"), //blue dragon I library.Get <BlueprintBuff>("17d330af03f5b3042a4417ab1d45e484"), //brass dragon I library.Get <BlueprintBuff>("1032d4ffb1c56444ca5bfce2c778614d"), //bronze dragon I library.Get <BlueprintBuff>("a4cc7169fb7e64a4a8f53bdc774341b1"), //copper dragon I library.Get <BlueprintBuff>("89669cfba3d9c15448c23b79dd604c41"), //gold dragon I library.Get <BlueprintBuff>("02611a12f38bed340920d1d427865917"), //green dragon buff I library.Get <BlueprintBuff>("294cbb3e1d547f341a5d7ec8500ffa44"), //red dragon I library.Get <BlueprintBuff>("feb2ab7613e563e45bcf9f7ffe4e05c6"), //silver dragon I library.Get <BlueprintBuff>("a6acd3ad1e9fa6c45998d43fd5dcd86d"), //white dragon buff I library.Get <BlueprintBuff>("9eb5ba8c396d2c74c8bfabd3f5e91050"), //black dragon II library.Get <BlueprintBuff>("cf8b4e861226e0545a6805036ab2a21b"), //blue dragon II library.Get <BlueprintBuff>("f7fdc15aa0219104a8b38c9891cac17b"), //brass dragon II library.Get <BlueprintBuff>("53e408cab2331bd48a3db846e531dfe8"), //bronze dragon II library.Get <BlueprintBuff>("799c8b6ae43c7d741ac7887c984f2aa2"), //copper dragon II library.Get <BlueprintBuff>("4300f60c00ecabc439deab11ce6d738a"), //gold dragon II library.Get <BlueprintBuff>("070543328d3e9af49bb514641c56911d"), //green dragon buff II library.Get <BlueprintBuff>("40a96969339f3c241b4d989910f255e1"), //red dragon II library.Get <BlueprintBuff>("16857109dafc2b94eafd1e888552ef76"), //silver dragon II library.Get <BlueprintBuff>("2652c61dff50a24479520c84005ede8b"), //white dragon buff II library.Get <BlueprintBuff>("c231e0cf7c203644d81e665d6115ae69"), //black dragon III library.Get <BlueprintBuff>("a4993affb4c4ad6429eca6daeb7b86a8"), //blue dragon III library.Get <BlueprintBuff>("8acd6ac6f89c73b4180191eb63768009"), //brass dragon III library.Get <BlueprintBuff>("1d3d388fd7b740842bde43dfb0aa56bb"), //bronze dragon III library.Get <BlueprintBuff>("c0e8f767f87ac354495865ce3dc3ee46"), //copper dragon III library.Get <BlueprintBuff>("ec6ad3612c4f0e340b54a11a0e78793d"), //gold dragon III library.Get <BlueprintBuff>("2d294863adf81f944a7558f7ae248448"), //green dragon buff III library.Get <BlueprintBuff>("782d09044e895fa44b9b6d9cca3a52b5"), //red dragon III library.Get <BlueprintBuff>("80babfb32011f384ea865d768857da79"), //silver dragon III library.Get <BlueprintBuff>("8dae421e48035a044a4b1a7b9208c5db"), //white dragon buff III }; for (int i = 0; i < facts.Length; i++) { facts[i].AddComponents(airborne.ComponentsArray); if (i < 12) { facts[i].AddComponent(Helpers.CreateAddFact(air_mastery)); } } var airborne_types = new BlueprintUnitType[] { library.Get <BlueprintUnitType>("b012216cc6867354fb088d0c36968ea3"), //black dragon library.Get <BlueprintUnitType>("f52b75839bb928242b6108df9d7f35a2"), //wyvern library.Get <BlueprintUnitType>("284b6fd0b67688a4bb3ec28b15152d69"), //ankou library.Get <BlueprintUnitType>("a574fa56e67623d41b538bdeae291fd5"), //gargoyle library.Get <BlueprintUnitType>("535823c600a2c8f4a906063b7b949eb5"), //jabberwok library.Get <BlueprintUnitType>("248c45d90c2f6e7429358fbe503e9c08") //manticore }; var units = library.GetAllBlueprints().OfType <BlueprintUnit>(); foreach (var unit in units) { if (airborne_types.Contains(unit.Type)) { unit.AddFacts = unit.AddFacts.AddToArray(airborne); } } }