mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
use .select() in loop
This commit is contained in:
1 parent
2a4d16e65e
commit
df7c182abb
1 file changed
+9
-7
@@ -28,11 +28,12 @@ public static class LogicRoleSelectionNormalPatch
|
||||
|
||||
// Assign guaranteed roles first, just like the vanilla selector. This is
|
||||
// important because the list of players is shared by both team passes.
|
||||
foreach (var role in source.Where(x => roleOptions.GetChancePerGame(x.Role) == 100))
|
||||
foreach (var role in source.Where(x => roleOptions.GetChancePerGame(x.Role) == 100)
|
||||
.Select(role => role.Role))
|
||||
{
|
||||
for (var i = 0; i < roleOptions.GetNumPerGame(role.Role); i++)
|
||||
for (var i = 0; i < roleOptions.GetNumPerGame(role); i++)
|
||||
{
|
||||
list.Add(role.Role);
|
||||
list.Add(role);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,13 +44,14 @@ public static class LogicRoleSelectionNormalPatch
|
||||
list.Clear();
|
||||
foreach (var role in source.Where(x =>
|
||||
roleOptions.GetChancePerGame(x.Role) > 0 &&
|
||||
roleOptions.GetChancePerGame(x.Role) < 100))
|
||||
roleOptions.GetChancePerGame(x.Role) < 100)
|
||||
.Select(role => role.Role))
|
||||
{
|
||||
for (var i = 0; i < roleOptions.GetNumPerGame(role.Role); i++)
|
||||
for (var i = 0; i < roleOptions.GetNumPerGame(role); i++)
|
||||
{
|
||||
if (HashRandom.Next(101) < roleOptions.GetChancePerGame(role.Role))
|
||||
if (HashRandom.Next(101) < roleOptions.GetChancePerGame(role))
|
||||
{
|
||||
list.Add(role.Role);
|
||||
list.Add(role);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user