static void FixBloodlinePrerequisite(BlueprintFeature feat) { var components = feat.ComponentsArray.Where(c => !(c is PrerequisiteFeature || c is PrerequisiteFeaturesFromList)).ToList(); foreach (var p in feat.GetComponents <PrerequisiteFeature>()) { BlueprintProgression crossbloodline; if (crossbloodForBloodline.TryGetValue(p.Feature as BlueprintProgression, out crossbloodline)) { var prereq = Helpers.PrerequisiteFeaturesFromList(p.Feature, crossbloodline); prereq.Group = p.Group; components.Add(prereq); } else { components.Add(p); } } foreach (var prereq in feat.GetComponents <PrerequisiteFeaturesFromList>().ToList()) { var features = prereq.Features.ToList(); foreach (var f in prereq.Features) { BlueprintProgression crossbloodline; if (crossbloodForBloodline.TryGetValue(f as BlueprintProgression, out crossbloodline)) { features.Add(crossbloodline); } } var newPrereq = Helpers.PrerequisiteFeaturesFromList(features); newPrereq.Group = prereq.Group; components.Add(newPrereq); } feat.SetComponents(components); }
static public void undeadImmunitiesChange() { BlueprintFeature undeadImmunities = library.Get <BlueprintFeature>("8a75eb16bfff86949a4ddcb3dd2f83ae"); //Undead have 3 condition immunities, 1 for nauseated, 1 for fatigued and 1 for sickened //They also 2 base buff descriptor immunities, which in turn each grant many immunities //Buff descriptor immunity: Poison, Disease, Sickened, Shaken, Fatigue, Frightened, Exhausted, Confusion, Death, Bleed, VilderavnBleed //Buff descriptor immunity: MindAffecting, Fear, Compulsion, Emotion, Charm, Daze, Shaken, Frightened, Confusion, Sleep //Stun and sleep are added here because, by PnP rules, Undead are immune to these traits in addition to being immune to mind-affecting things //SpellDescriptor sd1 = (SpellDescriptor)((long)SpellDescriptor.Poison + (long)SpellDescriptor.Disease + (long)SpellDescriptor.Fatigue + (long)SpellDescriptor.Exhausted + (long)SpellDescriptor.Death + (long)SpellDescriptor.Bleed + (long)SpellDescriptor.VilderavnBleed) + (long)SpellDescriptor.Stun + (long)SpellDescriptor.Sleep; SpellDescriptor sd1 = (SpellDescriptor)((long)SpellDescriptor.Poison + (long)SpellDescriptor.Disease + (long)SpellDescriptor.Sickened + (long)SpellDescriptor.Fatigue + (long)SpellDescriptor.Exhausted + (long)SpellDescriptor.Death + (long)SpellDescriptor.Bleed + (long)SpellDescriptor.VilderavnBleed + (long)SpellDescriptor.Stun + (long)SpellDescriptor.Sleep); //The list to bypass now includes only mindaffecting elements. As the PnP rules do not specificy that Daze //is mind-affecting that has been removed from their immunities entirely //its possible that this should be the mindaffecting trait alone or all of the mind affecting things //SpellDescriptor sd2 = (SpellDescriptor)((long)SpellDescriptor.MindAffecting + (long)SpellDescriptor.Fear + (long)SpellDescriptor.Compulsion + (long)SpellDescriptor.Emotion + (long)SpellDescriptor.Charm + (long)SpellDescriptor.Shaken + (long)SpellDescriptor.Frightened + (long)SpellDescriptor.Confusion); SpellDescriptor sd2 = (SpellDescriptor)((long)SpellDescriptor.MindAffecting); foreach (BuffDescriptorImmunity bdi in undeadImmunities.GetComponents <BuffDescriptorImmunity>()) { if ((long)bdi.Descriptor.Value == 6597687263488) //This is the first buff descriptor's value which includes redundant buffs { bdi.Descriptor = sd1; } if ((long)bdi.Descriptor.Value == 4366631152) { bdi.Descriptor = sd2; } //Main.logger.Log("Buff descriptor immunity list: " + bdi.Descriptor.Value.ToString()); } //undead also have a derivative stat bonus immunity which they should retain //undead have immunitities to spells in a manner similar to buffs. They are immune to Any spell with a descriptor that matches their condition immunities //The value is different here because the base game immunities do not include the VildravenBleed from the conditions immunities list //This block function similarly to the one above just for spell immunity instead of just condition immunity foreach (SpellImmunityToSpellDescriptor sitsd in undeadImmunities.GetComponents <SpellImmunityToSpellDescriptor>()) { if ((long)sitsd.Descriptor.Value == 2199640752384) //the initial value similar to above minus the value of the vildravn bleed. yes it is a 13 digit number thank you very much { sitsd.Descriptor = sd1; } if ((long)sitsd.Descriptor.Value == 4366631152) { sitsd.Descriptor = sd2; } //Main.logger.Log("Spell descriptor immunity list: " + sitsd.Descriptor.Value.ToString()); } //because undead should be immune to all fortitude negates effects, they should have immunity to the baleful polymorph buff BlueprintBuff balefulPolymorphBuff = library.Get <BlueprintBuff>("0a52d8761bfd125429842103aed48b90"); SpecificBuffImmunity sbi = new SpecificBuffImmunity { Buff = balefulPolymorphBuff }; undeadImmunities.ComponentsArray = undeadImmunities.ComponentsArray.AddToArray(sbi); }
static void FixDragonDisciple(BlueprintFeature feat, BlueprintFeature[] bloodlines) { feat.AddComponents( feat.GetComponents <AddFeatureIfHasFact>() .Where(a => bloodlines.Contains(a.CheckedFact)) .Select(addFeat => { var newAdd = UnityEngine.Object.Instantiate(addFeat); newAdd.CheckedFact = crossbloodForBloodline[(BlueprintProgression)addFeat.CheckedFact]; return(newAdd); })); foreach (var addOnClass in feat.GetComponents <AddFeatureOnClassLevel>()) { FixDragonDisciple(addOnClass.Feature, bloodlines); } }
static void addToChannelingScourge(ChannelEntry c) { if (channeling_scourge == null) { return; } var cleric = library.Get <BlueprintCharacterClass>("67819271767a9dd4fbfd4ae700befea0"); if (c.channel_type.isOf(ChannelType.Harm) && c.channel_type.isNotOf(ChannelType.BackToTheGrave) && c.scalesWithClass(cleric)) { var components = channeling_scourge.GetComponents <NewMechanics.ContextIncreaseCasterLevelForSelectedSpells>(); foreach (var component in components) { component.spells = component.spells.AddToArray(c.ability); } } }
static void CreateAbundantRevelations(BlueprintFeature revelation, BlueprintFeatureSelection abundantRevelations, List <BlueprintFeature> resourceChoices, List <Prerequisite> prereqRevelations, HashSet <BlueprintFeature> seen) { if (revelation == LifeMystery.lifeLink) { return; } bool first = true; foreach (var resourceLogic in revelation.GetComponents <AddAbilityResources>()) { if (!seen.Add(revelation)) { continue; } var resource = resourceLogic.Resource; var feature = Helpers.CreateFeature($"{abundantRevelations.name}{revelation.name}", $"{abundantRevelations.Name} — {revelation.Name}", $"{abundantRevelations.Description}\n{revelation.Description}", Helpers.MergeIds("d2f3b9be00b04940805bff7b7f60381f", revelation.AssetGuid, resource.AssetGuid), revelation.Icon, FeatureGroup.None, revelation.PrerequisiteFeature(), resource.CreateIncreaseResourceAmount(1)); resourceChoices.Add(feature); if (first) { prereqRevelations.Add(revelation.PrerequisiteFeature(true)); first = false; } } var selection = revelation as BlueprintFeatureSelection; if (selection == null) { return; } foreach (var r in selection.Features) { CreateAbundantRevelations(r, abundantRevelations, resourceChoices, prereqRevelations, seen); } }