Skip to content

Commit

Permalink
adding some logging to see what's wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
AlchlcDvl committed Oct 6, 2024
1 parent 6220ba4 commit 41aa5ff
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions MiraAPI/Modifiers/ModifierManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,24 @@ internal static void RegisterModifier(Type modifierType)

internal static void AssignModifiers(List<PlayerControl> plrs)
{
foreach (var player in plrs)
{
Logger<MiraApiPlugin>.Message(player.Data.PlayerName);
}

var rand = new Random();
var sequence = PrioritiesToIdsMap.Keys.OrderByDescending(x => x);

foreach (var priority in sequence)
{
var map = new List<uint>();
var filteredModifiers = new List<uint>();
Logger<MiraApiPlugin>.Message(priority);

foreach (var modifier in PrioritiesToIdsMap[priority])
foreach (var id in PrioritiesToIdsMap[priority])
{
var mod = Activator.CreateInstance(IdToTypeModifierMap[modifier]) as GameModifier;
var maxCount = plrs.Count(x => IsGameModifierValid(x, mod!, modifier));
var mod = Activator.CreateInstance(IdToTypeModifierMap[id]) as GameModifier;
var maxCount = plrs.Count(x => IsGameModifierValid(x, mod!, id));
Logger<MiraApiPlugin>.Message(maxCount);

if (maxCount == 0)
{
Expand All @@ -104,12 +111,12 @@ internal static void AssignModifiers(List<PlayerControl> plrs)

if (randomNum < Math.Clamp(chance, 0, 100))
{
map.Add(modifier);
filteredModifiers.Add(id);
}
}
}

var shuffledList = map.ToList().Randomize();
var shuffledList = filteredModifiers.ToList().Randomize();

if (shuffledList.Count > plrs.Count)
{
Expand Down

0 comments on commit 41aa5ff

Please sign in to comment.