fix: Removes side effect of setting skill mod when changing Owner (#1101)

## Breaking Change!
Setting `mod.Owner` will no longer update a skill mod.
**Please stick to the API and use `mobile.AddSkillMod(mod)` for all situations, including equipping.**


## Fixes
- [X] Fixes memory leak in factions.
- [X] Changes `List<SkillMod>` to `HashSet<SkillMod>`.
- [X] Eliminates skill mods adding/removing twice.
This commit is contained in:
Kamron Batman 2022-06-30 12:07:08 -07:00 • committed by GitHub
parent 414ef8d8d6
commit cb474712f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 80 additions and 109 deletions

View file

@ -276,30 +276,30 @@ namespace Server
double bonusObey = 0.0, bonusNotObey = 0.0;
for (var i = 0; i < mods.Count; ++i)
foreach (var mod in mods)
{
var mod = mods[i];
if (mod.Skill == (SkillName)Info.SkillID)
if (mod.Skill != (SkillName)Info.SkillID)
{
if (mod.Relative)
continue;
}
if (mod.Relative)
{
if (mod.ObeyCap)
{
if (mod.ObeyCap)
{
bonusObey += mod.Value;
}
else
{
bonusNotObey += mod.Value;
}
bonusObey += mod.Value;
}
else
{
bonusObey = 0.0;
bonusNotObey = 0.0;
value = mod.Value;
bonusNotObey += mod.Value;
}
}
else
{
bonusObey = 0.0;
bonusNotObey = 0.0;
value = mod.Value;
}
}
value += bonusNotObey;