Creates random element extension (#196)

This commit is contained in:
Kamron Batman 2020-08-21 19:50:36 -07:00 • committed by GitHub
parent 0926b5abaa
commit 4403d6c1c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
84 changed files with 226 additions and 330 deletions

View file

@ -692,7 +692,7 @@ namespace Server.Engines.ConPVP
rn -= ae.Value;
}
return arenas[Utility.Random(arenas.Count)].m_Arena;
return arenas.RandomElement().m_Arena;
}
public static Arena FindArena()

View file

@ -284,7 +284,7 @@ namespace Server.Engines.ConPVP
}
case TieType.Random:
{
TourneyParticipant advanced = remaining[Utility.Random(remaining.Count)];
TourneyParticipant advanced = remaining.RandomElement();
for (int i = 0; i < remaining.Count; ++i)
if (remaining[i] != advanced)

View file

@ -131,13 +131,13 @@ namespace Server.Engines.ConPVP
if (toAdvance.Count == 0)
toAdvance = copy; // sanity
int idx = Utility.Random(toAdvance.Count);
var random = toAdvance.RandomElement();
toAdvance[idx].AddLog(
random.AddLog(
"Advanced automatically due to an odd number of challengers.");
level.FreeAdvance = toAdvance[idx];
level.FreeAdvance = random;
++level.FreeAdvance.FreeAdvances;
copy.Remove(toAdvance[idx]);
copy.Remove(random);
}
while (copy.Count >= partsPerMatch)