Added more header stuff (requires and uses) along with a forgotten PartialPlay

This commit is contained in:
Jeff Moser
2010-09-18 21:19:51 -04:00
parent 071bf16569
commit f2eca28f29
13 changed files with 129 additions and 12 deletions

30
PartialPlay.php Normal file
View File

@ -0,0 +1,30 @@
<?php
namespace Moserware\Skills;
require_once(dirname(__FILE__) . "/ISupportPartialPlay.php");
class PartialPlay
{
public static function getPartialPlayPercentage($player)
{
// If the player doesn't support the interface, assume 1.0 == 100%
$supportsPartialPlay = $player instanceof ISupportPartialPlay;
if (!$supportsPartialPlay)
{
return 1.0;
}
$partialPlayPercentage = $partialPlay->getPartialPlayPercentage();
// HACK to get around bug near 0
$smallestPercentage = 0.0001;
if ($partialPlayPercentage < $smallestPercentage)
{
$partialPlayPercentage = $smallestPercentage;
}
return $partialPlayPercentage;
}
}
?>