static public void LoadNeutral() { RisiaAddFacts = new List <BlueprintFeature>(); compNeutral = Helpers.Create <AddClassLevels>(); compNeutral.Archetypes = new BlueprintArchetype[] { }; compNeutral.CharacterClass = arcanist; compNeutral.Levels = 7; compNeutral.LevelsStat = StatType.Intelligence; compNeutral.Skills = new StatType[] { StatType.SkillKnowledgeArcana, StatType.SkillKnowledgeWorld, StatType.SkillPersuasion, StatType.SkillStealth, StatType.SkillPerception, StatType.SkillUseMagicDevice, StatType.SkillMobility }; compNeutral.SelectSpells = RisiaSpellKnownLevelupSelect; compNeutral.MemorizeSpells = RisiaSpellMemory; BlueprintFeatureSelection basicFeatSelection = getSelection("247a4068296e8be42890143f451b4b45"); BlueprintParametrizedFeature spellFocus = getFeat("16fa59cc9a72a6043b566b49184f53fe") as BlueprintParametrizedFeature; List <SelectionEntry> selectionEntryList = new List <SelectionEntry>(); selectionEntryList.Add(new SelectionEntry { Selection = basicFeatSelection,//basic feat selection Features = RisiaFeats }); selectionEntryList.Add(new SelectionEntry { Selection = getSelection("247a4068296e8be42890143f451b4b45"), IsParametrizedFeature = true, ParametrizedFeature = spellFocus, ParamSpellSchool = SpellSchool.Illusion }); selectionEntryList.Add(new SelectionEntry { Selection = getSelection("247a4068296e8be42890143f451b4b45"), IsParametrizedFeature = true, ParametrizedFeature = spellFocus, ParamSpellSchool = SpellSchool.Enchantment }); selectionEntryList.Add(new SelectionEntry { Selection = ArcaneExploits.exploitSelection, Features = RisiaArcaneExploits }); compNeutral.Selections = selectionEntryList.ToArray(); learnNeutral = Helpers.Create <LearnSpells>(a => { a.Spells = RisiaSpellKnownAfterwards; a.CharacterClass = ArcanistClass.arcanist; }); var RisiaLearnSpellFeat = Helpers.CreateFeature("RisiaLearnSpellFeat", "", "", OtherUtils.GetMd5("Risia.LearnSpellFeat"), null, FeatureGroup.None, learnNeutral); RisiaAddFacts.Add(RisiaLearnSpellFeat); }
static void addDeityToCompanion(AddClassLevels add_classLevels, BlueprintFeature deity) { var deity_selection = new SelectionEntry(); deity_selection.Selection = ResourcesLibrary.TryGetBlueprint <BlueprintFeatureSelection>("59e7a76987fe3b547b9cce045f4db3e4"); deity_selection.Features = new BlueprintFeature[] { deity }; add_classLevels.Selections = add_classLevels.Selections.AddToArray(deity_selection); }
internal static bool Prefix(AddPet __instance) { if (!__instance.Owner.IsPlayerFaction) { return(true); } if (__instance.SpawnedPet == null) { return(false); } AddClassLevels component = __instance.SpawnedPet.Blueprint.GetComponent <AddClassLevels>(); if (component == null) { return(false); } int pet_level = 0; var eidolon = __instance.SpawnedPet.Blueprint.GetComponent <Eidolon.EidolonComponent>(); if (eidolon == null) { var tr = Harmony12.Traverse.Create(__instance); pet_level = tr.Method("GetPetLevel").GetValue <int>(); } else { pet_level = eidolon.getEidolonLevel(__instance); } //Main.logger.Log("Pet level: " + __instance.SpawnedPet.Descriptor.Progression.CharacterLevel.ToString()); //Main.logger.Log("Should be: " + pet_level.ToString()); if (pet_level > __instance.SpawnedPet.Descriptor.Progression.CharacterLevel) { if (__instance.SpawnedPet.Descriptor.Progression.CharacterLevel == 0) { component.LevelUp(__instance.SpawnedPet.Descriptor, 1); } var exp = Game.Instance.BlueprintRoot.Progression.XPTable.GetBonus(pet_level); Harmony12.Traverse.Create(__instance.SpawnedPet.Descriptor.Progression).Property("Experience").SetValue(exp); EventBus.RaiseEvent <IUnitGainExperienceHandler>((Action <IUnitGainExperienceHandler>)(h => h.HandleUnitGainExperience(__instance.SpawnedPet.Descriptor, exp))); //Main.logger.Log("Pet level now: " + __instance.SpawnedPet.Descriptor.Progression.CharacterLevel.ToString()); } if (eidolon != null) {//no upgrade for eidolon, since they are performed through summoner return(false); } int?rank = __instance.Owner.GetFact((BlueprintUnitFact)__instance.LevelRank)?.GetRank(); if (Mathf.Min(20, !rank.HasValue ? 0 : rank.Value) < __instance.UpgradeLevel) { return(false); } __instance.SpawnedPet.Descriptor.Progression.Features.AddFeature(__instance.UpgradeFeature, (MechanicsContext)null); return(false); }
static public void replaceAcl(AddClassLevels old_acl, AddClassLevels new_acl) { old_acl.CharacterClass = new_acl.CharacterClass; old_acl.Archetypes = new_acl.Archetypes; old_acl.Levels = new_acl.Levels; old_acl.MemorizeSpells = new_acl.MemorizeSpells; old_acl.RaceStat = new_acl.RaceStat; old_acl.Skills = new_acl.Skills; old_acl.SelectSpells = new_acl.SelectSpells; old_acl.Selections = new_acl.Selections; old_acl.LevelsStat = new_acl.LevelsStat; }
public Profile(string profile_name, BlueprintCharacterClass character_class, StatType stat, StatType[] skills, BlueprintArchetype archetype = null) { name = profile_name; acl = Helpers.Create <AddClassLevels>(); acl.CharacterClass = character_class; if (archetype != null) { acl.Archetypes = new BlueprintArchetype[] { archetype }; } acl.RaceStat = stat; acl.LevelsStat = stat; acl.MemorizeSpells = new BlueprintAbility[0]; acl.SelectSpells = new BlueprintAbility[0]; acl.Skills = skills; acl.Selections = new SelectionEntry[0]; brain = Main.library.CopyAndAdd <BlueprintBrain>("bf90f2053c06375418c119115122ae3d", name + "Brain", ""); brain.Actions = new BlueprintAiAction[0]; }
private static bool Prefix(ref Kingmaker.UnitLogic.FactLogic.AddPet __instance) { if (!ModSettings.enableSuperPet) { return(true); } if (__instance.SpawnedPet == null) { return(false); } AddClassLevels component = __instance.SpawnedPet.Blueprint.GetComponent <AddClassLevels>(); if (!component) { return(false); } int characterLevel = __instance.SpawnedPet.Descriptor.Progression.CharacterLevel; //int petLevel = __instance.GetPetLevel(); // function is private, and we have duplicated it ... int petLevel = 0; AnimalCompanionPatch2.Prefix(ref __instance, ref petLevel); int num = petLevel - characterLevel; if (num > 0) { component.LevelUp(__instance.SpawnedPet.Descriptor, num); } int a = RankToLevel.Length; Fact fact = __instance.Owner.GetFact(__instance.LevelRank); int? num2 = (fact != null) ? new int?(fact.GetRank()) : null; int num3 = UnityEngine.Mathf.Min(a, (num2 == null) ? 0 : num2.Value); if (num3 >= __instance.UpgradeLevel) { __instance.SpawnedPet.Descriptor.Progression.Features.AddFeature(__instance.UpgradeFeature, null); } return(false); }
// {} [] <> () private static bool updateAnimalCompanion() { const int extraLevel = 20; { BlueprintArchetype aca = GetBlueprint <BlueprintArchetype>("AnimalCompanionArchetype"); if (aca == null) { return(false); } int acal = aca.AddFeatures.Length; logger.Log($"AnimalCompanionArchetype AddFeatures.Length: {acal}"); // LevelEntry source = aca.AddFeatures[acal - 1] as LevelEntry; // if (source == null) // return false; System.Array.Resize(ref aca.AddFeatures, acal + extraLevel); for (int i = acal; i < acal + extraLevel; i++) { LevelEntry nl = new LevelEntry(); nl.Level = aca.AddFeatures[i - 1].Level + 1; nl.Features = new List <BlueprintFeatureBase>(); if (nl.Level % 2 == 0) { BlueprintFeature bf = GetBlueprint <BlueprintFeature>("AnimalCompanionNaturalArmor"); if (bf != null) { bf.Ranks++; nl.Features.Add(bf); } else { logger.Warning($"Can't find AnimalCompanionNaturalArmor"); } } else { BlueprintFeature bf = GetBlueprint <BlueprintFeature>("AnimalCompanionStrengthDexterityConstitution"); if (bf != null) { bf.Ranks++; nl.Features.Add(bf); } else { logger.Warning($"Can't find AnimalCompanionStrengthDexterityConstitution"); } } if (nl.Level % 3 == 0) { BlueprintFeature bf = GetBlueprint <BlueprintFeature>("AnimalCompanionAttacksEnhancement"); if (bf != null) { bf.Ranks++; nl.Features.Add(bf); } else { logger.Warning($"Can't find AnimalCompanionAttacksEnhancement"); } } aca.AddFeatures[i] = nl; } logger.Log($"AnimalCompanionArchetype NEW AddFeatures.Length: {aca.AddFeatures.Length}"); } { BlueprintProgression acbp = GetBlueprint <BlueprintProgression>("AnimalCompanionBonusesProgression"); if (acbp == null) { return(false); } int acbpl = acbp.LevelEntries.Length; logger.Log($"AnimalCompanionBonusesProgression LevelEntries.Length: {acbpl}"); // LevelEntry source = aca.AddFeatures[acal - 1] as LevelEntry; // if (source == null) // return false; System.Array.Resize(ref acbp.LevelEntries, acbpl + extraLevel); for (int i = acbpl; i < acbpl + extraLevel; i++) { LevelEntry nl = new LevelEntry(); nl.Level = acbp.LevelEntries[i - 1].Level + 1; nl.Features = new List <BlueprintFeatureBase>(); if (nl.Level % 2 == 0) { BlueprintFeature bf = GetBlueprint <BlueprintFeature>("AnimalCompanionNaturalArmor"); if (bf != null) { //bf.Ranks++; nl.Features.Add(bf); } else { logger.Warning($"Can't find AnimalCompanionNaturalArmor"); } } else { BlueprintFeature bf = GetBlueprint <BlueprintFeature>("AnimalCompanionStrengthDexterityConstitution"); if (bf != null) { //bf.Ranks++; nl.Features.Add(bf); } else { logger.Warning($"Can't find AnimalCompanionStrengthDexterityConstitution"); } } if (nl.Level % 3 == 0) { BlueprintFeature bf = GetBlueprint <BlueprintFeature>("AnimalCompanionAttacksEnhancement"); if (bf != null) { //bf.Ranks++; nl.Features.Add(bf); } else { logger.Warning($"Can't find AnimalCompanionAttacksEnhancement"); } } acbp.LevelEntries[i] = nl; } logger.Log($"AnimalCompanionBonusesProgression NEW LevelEntries.Length: {acbp.LevelEntries.Length}"); } BlueprintFeature acr = GetBlueprint <BlueprintFeature>("AnimalCompanionRank"); if (acr == null) { return(false); } acr.Ranks += extraLevel; logger.Log($"AnimalCompanionRank NEW Ranks: {acr.Ranks}"); // Game.Instance.BlueprintRoot.Progression.AnimalCompanion.DefaultBuild.Name if (Game.Instance.BlueprintRoot.Progression.AnimalCompanion != null) { if (Game.Instance.BlueprintRoot.Progression.AnimalCompanion.DefaultBuild != null) { if (Game.Instance.BlueprintRoot.Progression.AnimalCompanion.DefaultBuild.Name != null) { logger.Log($"Game.Instance.BlueprintRoot.Progression.AnimalCompanion.DefaultBuild.Name is {Game.Instance.BlueprintRoot.Progression.AnimalCompanion.DefaultBuild.Name}"); } else { logger.Warning($"Game.Instance.BlueprintRoot.Progression.AnimalCompanion.DefaultBuild.Name is null"); } } else { logger.Warning($"Game.Instance.BlueprintRoot.Progression.AnimalCompanion.DefaultBuild is null"); List <String> lf = Harmony12.Traverse.Create(Game.Instance.BlueprintRoot.Progression.AnimalCompanion).Fields(); foreach (String f in lf) { Harmony12.Traverse fin = Harmony12.Traverse.Create(Game.Instance.BlueprintRoot.Progression.AnimalCompanion).Field(f); logger.Log($"Object {Game.Instance.BlueprintRoot.Progression.AnimalCompanion.ToString()}: field \"{f}\" (value \"{fin.GetValue()}\")"); } } } else { logger.Warning($"Game.Instance.BlueprintRoot.Progression.AnimalCompanion is null"); } //if (true) { String[] allpets = { "AnimalCompanionUnit", "AnimalCompanionUnitBear", "AnimalCompanionUnitBoar", "AnimalCompanionUnitCentipede", "AnimalCompanionUnitDog", "AnimalCompanionUnitElk", "AnimalCompanionUnitLeopard", "AnimalCompanionUnitMammoth", "AnimalCompanionUnitMonitor", "AnimalCompanionUnitSmilodon", "AnimalCompanionUnitWolf" }; String[] extrafeats = { "BlindFight", "Improved Initiative", // yes, with a space... "BlindFightImproved", "Mobility", "BlindFightGreater", "LightningReflexes", "BlindingCriticalFeature", "Outflank", "SiezeTheMoment" // yes, with that spelling... }; foreach (String thepet in allpets) { BlueprintUnit p = GetBlueprint <BlueprintUnit>(thepet); if (p == null) { logger.Warning($"Can't find {thepet}"); continue; } AddClassLevels acl = p.GetComponent <AddClassLevels>(); if (acl == null) { logger.Warning($"Can't find AddClassLevels for {thepet}"); continue; } int sl = acl.Selections.Length; /* if (sl > 1) * { * logger.Warning($"Chopping acl.Selections..."); * System.Array.Resize<SelectionEntry>(ref acl.Selections, 1); * sl = 1; * } */ for (int i = 0; i < sl; i++) { int fl = acl.Selections[i].Features.Length; logger.Log($"{thepet} had {fl} features"); System.Array.Resize <BlueprintFeature>(ref acl.Selections[i].Features, fl + extrafeats.Length); for (int j = 0; j < extrafeats.Length; j++) { BlueprintFeature bf = GetBlueprint <BlueprintFeature>(extrafeats[j]); acl.Selections[i].Features[fl + j] = bf; if (bf == null) { logger.Warning($"Couldn't find {extrafeats[j]} for {thepet}"); } } logger.Log($"{thepet} now has {acl.Selections[i].Features.Length} features"); } } } return(true); }
public TestAddClassLevels(AddClassLevels instance) { this.instance = instance; }