-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreatePlayer.php
More file actions
36 lines (28 loc) · 932 Bytes
/
CreatePlayer.php
File metadata and controls
36 lines (28 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
include_once('RandomPlayer.php');
include_once('Combatants.php');
/**
* @description picks a random battler and sets random properties for battler
* @var $battler string
* @var $name string
*
*/
class CreatePlayer
{
public function __construct($name)
{
$this->name = $name;
}
public function Player() {
$battler = RandomPlayer::returnPlayer();
$fighter = new Fighter();
$fighter->setName($this->name);
$fighter->setBattler($battler);
$fighter->setHealth(RandomPlayer::playerProperties($battler,'health'));
$fighter->setStrength(RandomPlayer::playerProperties($battler,'strength'));
$fighter->setDefense(RandomPlayer::playerProperties($battler,'defence'));
$fighter->setSpeed(RandomPlayer::playerProperties($battler,'speed'));
$fighter->setLuck(RandomPlayer::playerProperties($battler,'luck'));
return $fighter;
}
}