Score calculation improvements
This commit is contained in:
parent
dbea63edd3
commit
cfc558a3d2
4
main.php
4
main.php
|
@ -148,9 +148,9 @@ while ($gameRuntime)
|
|||
echo 'You lost this match of Rock Paper Scissors! Thank you for playing!' . PHP_EOL;
|
||||
}
|
||||
echo PHP_EOL;
|
||||
echo 'The main menu will appear in five seconds...';
|
||||
echo 'The main menu will appear in fifteen seconds...';
|
||||
|
||||
sleep(5);
|
||||
sleep(15);
|
||||
|
||||
Menu::clearScreen();
|
||||
unset($robot, $human, $computerChoiceItem, $humanChoiceItem);
|
||||
|
|
|
@ -73,19 +73,31 @@ class Player
|
|||
|
||||
public function registerWin()
|
||||
{
|
||||
if ($this->initialScore >= 1000)
|
||||
|
||||
$score = $this->initialScore;
|
||||
|
||||
if ($score <= 0)
|
||||
{
|
||||
// If your score is below zero, it slowly increases by the multiplier value instead of being multiplied again
|
||||
$this->initialScore = $score + $this->multiplier;
|
||||
}
|
||||
elseif($score >= 1000)
|
||||
{
|
||||
|
||||
$this->increaseLives();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->initialScore = $score * $this->multiplier;
|
||||
}
|
||||
|
||||
$this->initialScore = $this->initialScore * $this->multiplier;
|
||||
}
|
||||
|
||||
public function registerLoss()
|
||||
{
|
||||
$score = $this->initialScore;
|
||||
|
||||
if ($score <= 1)
|
||||
if ($score <= 0)
|
||||
{
|
||||
$this->decreaseLives();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue