This commit is contained in:
2023-11-09 19:24:47 +02:00
parent 1645f58a63
commit fc17eada24
19 changed files with 1255 additions and 953 deletions

View File

@@ -4,53 +4,59 @@ namespace User;
class UserCalculatedStats
{
private UserStats $userStats;
private UserStats $baseUserStats;
public int $hpAll;
public int $mpAll;
public function __construct(
private readonly UserStats $us
) {
UserStats $userStats
)
{
$this->userStats = $userStats;
$this->baseUserStats = $userStats;
$this->hpAll = $this->hpAll();
$this->mpAll = $this->mpAll();
}
private function hpAll(): int
{
$hpAll = $this->us->s4 * 5;
$hpAll += match (true){
$this->us->s4 >= 200 => 850,
$this->us->s4 >= 175 => 600,
$this->us->s4 >= 150 => 450,
$this->us->s4 >= 125 => 400,
$this->us->s4 >= 100 => 250,
$this->us->s4 >= 75 => 175,
$this->us->s4 >= 50 => 100,
$this->us->s4 >= 25 => 50,
$hpAll = $this->userStats->s4 * 5;
$hpAll += match (true) {
$this->userStats->s4 >= 200 => 850,
$this->userStats->s4 >= 175 => 600,
$this->userStats->s4 >= 150 => 450,
$this->userStats->s4 >= 125 => 400,
$this->userStats->s4 >= 100 => 250,
$this->userStats->s4 >= 75 => 175,
$this->userStats->s4 >= 50 => 100,
$this->userStats->s4 >= 25 => 50,
default => 0
};
return $hpAll;
}
private function mpAll():int
private function mpAll(): int
{
$mpAll = $this->us->s6 * 10;
$mpAll = $this->userStats->s6 * 10;
$mpAll += match (true) {
$this->us->s6 >= 200 => 1500,
$this->us->s6 >= 175 => 900,
$this->us->s6 >= 150 => 700,
$this->us->s6 >= 125 => 500,
$this->us->s6 >= 100 => 350,
$this->us->s6 >= 75 => 250,
$this->us->s6 >= 50 => 150,
$this->us->s6 >= 25 => 50,
$this->userStats->s6 >= 200 => 1500,
$this->userStats->s6 >= 175 => 900,
$this->userStats->s6 >= 150 => 700,
$this->userStats->s6 >= 125 => 500,
$this->userStats->s6 >= 100 => 350,
$this->userStats->s6 >= 75 => 250,
$this->userStats->s6 >= 50 => 150,
$this->userStats->s6 >= 25 => 50,
default => 0
};
return $mpAll;
}
public function __toString():string
public function __toString(): string
{
$arr = [];
foreach ($this as $k=>$v) {
foreach ($this as $k => $v) {
if (empty($v) || $k === 'us') {
continue;
}
@@ -62,7 +68,7 @@ class UserCalculatedStats
public function __debugInfo()
{
$arr = [];
foreach ($this as $k=>$v) {
foreach ($this as $k => $v) {
if ($k === 'us') {
continue;
}