Skip to content
This repository has been archived by the owner on Apr 6, 2024. It is now read-only.

Commit

Permalink
Maintain death fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaksuhn committed Dec 11, 2023
1 parent 9c80bf3 commit 166ae81
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions RotationSolver/Updaters/TargetUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -404,24 +404,24 @@ private static IEnumerable<BattleChara> GetPartyMembers(IEnumerable<BattleChara>
private static void MaintainDeathPeople(ref IEnumerable<BattleChara> deathAll, ref IEnumerable<BattleChara> deathParty)
{
SortedDictionary<uint, Vector3> locs = new();
foreach (var item in deathAll)
if (!deathAll.Any() && !deathParty.Any())
{
if (item is null) continue;
locs[item.ObjectId] = item.Position;
// Both collections are empty, nothing to maintain
return;
}
foreach (var item in deathParty)
void ProcessCollection(IEnumerable<BattleChara> collection)
{
if (item is null) continue;
locs[item.ObjectId] = item.Position;
}
if (deathAll is not null)
{
deathAll = FilterForDeath(deathAll);
}
if (deathParty is not null)
{
deathParty = FilterForDeath(deathParty);
foreach (var item in collection ?? Enumerable.Empty<BattleChara>())
{
locs[item.ObjectId] = item?.Position ?? Vector3.Zero;
}
}

ProcessCollection(deathAll);
ProcessCollection(deathParty);

deathAll = FilterForDeath(deathAll);
deathParty = FilterForDeath(deathParty);
_locations = locs;
}

Expand Down

0 comments on commit 166ae81

Please sign in to comment.