mirror of
https://github.com/furyfire/trueskill.git
synced 2025-01-16 01:47:39 +00:00
26 lines
775 B
C#
26 lines
775 B
C#
namespace Moserware.Skills
|
|
{
|
|
internal static class PartialPlay
|
|
{
|
|
public static double GetPartialPlayPercentage(object player)
|
|
{
|
|
// If the player doesn't support the interface, assume 1.0 == 100%
|
|
var partialPlay = player as ISupportPartialPlay;
|
|
if (partialPlay == null)
|
|
{
|
|
return 1.0;
|
|
}
|
|
|
|
double partialPlayPercentage = partialPlay.PartialPlayPercentage;
|
|
|
|
// HACK to get around bug near 0
|
|
const double smallestPercentage = 0.0001;
|
|
if (partialPlayPercentage < smallestPercentage)
|
|
{
|
|
partialPlayPercentage = smallestPercentage;
|
|
}
|
|
|
|
return partialPlayPercentage;
|
|
}
|
|
}
|
|
} |