private bool IsFeatureShouldBeApplied() { if (!required_facts.Empty() && !required_facts.Any(f => this.Owner.HasFact(f))) { return(false); } int class_level = ReplaceCasterLevelOfAbility.CalculateClassLevel(this.classes[0], this.classes.Skip(1).ToArray(), this.Owner, this.archetypes); if (!class_bonuses.Empty()) { for (int i = 0; i < class_bonuses.Length; i++) { if (this.Owner.Progression.Classes.Any(cd => cd.CharacterClass == classes[i])) { class_level += class_bonuses[i]; } } } if (class_level < min_level || class_level > max_level) { return(false); } return(true); }
static private void FixFactsWithReplaceCL() { List <BlueprintUnitFact> facts = new List <BlueprintUnitFact>(); foreach (string id in config.FactWithReplaceCL) { facts.Add(library.Get <BlueprintUnitFact>(id)); } facts.AddRange(draconicBreathFeatures); facts.AddRange(elementalBlastFeatures); foreach (var fact in facts) { ReplaceCasterLevelOfAbility comp = fact.GetComponent <ReplaceCasterLevelOfAbility>(); HelpersNeu.Add <BlueprintCharacterClass>(ref comp.AdditionalClasses, ArcanistClass.arcanist); HelpersNeu.Add <BlueprintArchetype>(ref comp.Archetypes, archetype); } }
static private void FixSpecialComponents() { //fix abjuration resistance buffs foreach (string buffId in config.AbjurationResistanceBuffs) { var buff = library.Get <BlueprintBuff>(buffId); WizardAbjurationResistance compOld = buff.GetComponent <WizardAbjurationResistance>(); WizardAbjurationResistanceNeu compNeu = Helpers.Create <WizardAbjurationResistanceNeu>(); compNeu.Type = compOld.Type; compNeu.Pool = compOld.Pool; compNeu.Value = compOld.Value; compNeu.ValueMultiplier = compOld.ValueMultiplier; compNeu.UseValueMultiplier = true; compNeu.UsePool = true; compNeu.Wizards = new BlueprintCharacterClass[] { wizard, ArcanistClass.arcanist }; buff.RemoveComponent(compOld); buff.AddComponent(compNeu); } //fix conjuration enhance summoning var conj1_feat = library.Get <BlueprintFeature>("cee0f7edbd874a042952ee150f878b84"); conj1_feat.RemoveComponent(conj1_feat.GetComponent <AddClassLevelToSummonDuration>()); AddClassLevelToSummonDurationNeu compNeu2 = Helpers.Create <AddClassLevelToSummonDurationNeu>(); compNeu2.CharacterClasses = new BlueprintCharacterClass[] { wizard, ArcanistClass.arcanist }; compNeu2.Half = true; conj1_feat.AddComponent(compNeu2); //fix evocation intense spell var evo1_feat = library.Get <BlueprintFeature>("c46512b796216b64899f26301241e4e6"); evo1_feat.RemoveComponent(evo1_feat.GetComponent <IntenseSpells>()); IntenseSpellsNeu compNeu3 = Helpers.Create <IntenseSpellsNeu>(); compNeu3.Wizards = new BlueprintCharacterClass[] { wizard, ArcanistClass.arcanist }; evo1_feat.AddComponent(compNeu3); //fix necromancy turn undead cl var necro1_feat = library.Get <BlueprintFeature>("927707dce06627d4f880c90b5575125f"); ReplaceCasterLevelOfAbility compOld4 = necro1_feat.GetComponent <ReplaceCasterLevelOfAbility>(); compOld4.AdditionalClasses = new BlueprintCharacterClass[] { ArcanistClass.arcanist }; //fix transmutation physical enhance foreach (string buffId in config.TransmutationPhysicalEnhanceBuffs) { var buff = library.Get <BlueprintBuff>(buffId); AddStatBonusScaled compOld5 = buff.GetComponent <AddStatBonusScaled>(); AddStatBonusScaledTransmutationSpecialized compNeu5 = Helpers.Create <AddStatBonusScaledTransmutationSpecialized>(); compNeu5.classes = new BlueprintCharacterClass[] { wizard, ArcanistClass.arcanist }; compNeu5.Descriptor = compOld5.Descriptor; compNeu5.Stat = compOld5.Stat; compNeu5.Value = compOld5.Value; buff.RemoveComponent(buff.GetComponent <AddStatBonusScaled>()); } //fix transmutation polymorphy var trans8_feat = library.Get <BlueprintFeature>("aeb56418768235640a3ee858d5ee05e8"); AddFeatureOnClassLevel compOld6 = trans8_feat.GetComponent <AddFeatureOnClassLevel>(); compOld6.AdditionalClasses = new BlueprintCharacterClass[] { ArcanistClass.arcanist }; }
protected override int CalcLevel() => ReplaceCasterLevelOfAbility.CalculateClassLevel(Class, AdditionalClasses, Owner, Archetypes);
static bool Prefix(ReplaceCasterLevelOfAbility __instance) { ReplaceCasterLevelOfAbility_CalculateClassLevel_Patch.currentFact = __instance.Fact; return(true); }