Skip to content

Commit

Permalink
fix for spell descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
EzioTheDeadPoet committed Jul 14, 2021
1 parent ab4ea7a commit 3de35cf
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions SlotsSlotsSlots/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ public static void RunPatch(IPatcherState<ISkyrimMod, ISkyrimModGetter> state)

(HashSet<IFormLinkGetter<IMagicEffectGetter>> carryWeight, HashSet<IFormLinkGetter<IMagicEffectGetter>> health) magicEffects = MagicEffects(state);

var carryWeightSpells = new HashSet<(Dictionary<FormKey, HashSet<IFormLinkNullable<IMagicEffectGetter>>> SpellAndEffects,Dictionary<IFormLinkNullable<IMagicEffectGetter>,HashSet<int>> EffectAndMagnitudes)>();
var carryWeightSpells = new HashSet<(Dictionary<FormKey, HashSet<FormKey>> SpellAndEffects,Dictionary<FormKey,HashSet<int>> EffectAndMagnitudes)>();

var SpellAndEffects = new Dictionary<FormKey, HashSet<IFormLinkNullable<IMagicEffectGetter>>>();
var EffectAndMagnitudes = new Dictionary<IFormLinkNullable<IMagicEffectGetter>, HashSet<int>>();
var SpellAndEffects = new Dictionary<FormKey, HashSet<FormKey>>();
var EffectAndMagnitudes = new Dictionary<FormKey, HashSet<int>>();


foreach (var spell in state.LoadOrder.PriorityOrder.Spell().WinningOverrides())
Expand All @@ -69,11 +69,11 @@ public static void RunPatch(IPatcherState<ISkyrimMod, ISkyrimModGetter> state)
float startingMagnitude = e.Data.Magnitude;
e.Data.Magnitude *= effectMultiplier;

SpellAndEffects.GetOrAdd(spell.FormKey).Add(e.BaseEffect);
SpellAndEffects.GetOrAdd(spell.FormKey).Add(e.BaseEffect.FormKey);

var finalMagnitudesHashSet = new HashSet<int>();
finalMagnitudesHashSet.Add((int)startingMagnitude);
if (EffectAndMagnitudes.TryGetValue(e.BaseEffect, out var magnitudesHashSet))
if (EffectAndMagnitudes.TryGetValue(e.BaseEffect.FormKey, out var magnitudesHashSet))
{
foreach (var magnitudeInSet in magnitudesHashSet)
{
Expand All @@ -82,10 +82,11 @@ public static void RunPatch(IPatcherState<ISkyrimMod, ISkyrimModGetter> state)
}
}

EffectAndMagnitudes.GetOrAdd(e.BaseEffect).UnionWith(finalMagnitudesHashSet);
EffectAndMagnitudes.GetOrAdd(e.BaseEffect.FormKey).UnionWith(finalMagnitudesHashSet);

carryWeightSpells.Add((SpellAndEffects,EffectAndMagnitudes));

if ((deepCopySpell.Description.ToString().Contains($"carry") || deepCopySpell.Description.ToString().Contains($"Carry")) && deepCopySpell.Description.ToString().Contains($"{startingMagnitude}"))
if (deepCopySpell.Description.ToString().Contains($"carry") || deepCopySpell.Description.ToString().Contains($"Carry"))
{
if ((int)e.Data.Magnitude != 1)
{
Expand Down Expand Up @@ -130,9 +131,9 @@ public static void RunPatch(IPatcherState<ISkyrimMod, ISkyrimModGetter> state)
{
foreach (var spellEffect in spellEffectSet)
{
if (carryWeightSpell.EffectAndMagnitudes.TryGetValue(spellEffect, out var magnitudesHasSet))
if (carryWeightSpell.EffectAndMagnitudes.TryGetValue(spellEffect, out var magnitudesHashSet))
{
foreach (int magnitude in magnitudesHasSet)
foreach (int magnitude in magnitudesHashSet)
{
if ((deepCopyPerk.Description.ToString().Contains($"carry") || deepCopyPerk.Description.ToString().Contains($"Carry")) && deepCopyPerk.Description.ToString().Contains($" {magnitude} "))
{
Expand Down

0 comments on commit 3de35cf

Please sign in to comment.