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
+1 -52
View File
@@ -21,12 +21,8 @@ readonly class UserStats
public int $mg3;
public int $mg4;
public int $mg7;
//public int $hpAll;
//public int $mpAll;
public function __construct(
array $a
)
public function __construct(array $a)
{
$this->s1 = $a['s1'] ?? 0;
$this->s2 = $a['s2'] ?? 0;
@@ -45,53 +41,6 @@ readonly class UserStats
$this->mg3 = max($a['mg3'] ?? 0, $a['mall'] ?? 0);
$this->mg4 = max($a['mg4'] ?? 0, $a['mall'] ?? 0);
$this->mg7 = $a['mg7'] ?? 0;
//$this->hpAll = $this->hpAll();
//$this->mpAll = $this->mpAll();
}
/*private function hpAll(): int
{
$hpAll = $this->s4 * 5;
$hpAll += match (true){
$this->s4 >= 200 => 850,
$this->s4 >= 175 => 600,
$this->s4 >= 150 => 450,
$this->s4 >= 125 => 400,
$this->s4 >= 100 => 250,
$this->s4 >= 75 => 175,
$this->s4 >= 50 => 100,
$this->s4 >= 25 => 50,
default => 0
};
return $hpAll;
}
private function mpAll():int
{
$mpAll = $this->s6 * 10;
$mpAll += match (true) {
$this->s6 >= 200 => 1500,
$this->s6 >= 175 => 900,
$this->s6 >= 150 => 700,
$this->s6 >= 125 => 500,
$this->s6 >= 100 => 350,
$this->s6 >= 75 => 250,
$this->s6 >= 50 => 150,
$this->s6 >= 25 => 50,
default => 0
};
return $mpAll;
}*/
public function __toString():string
{
$arr = [];
foreach ($this as $k=>$v) {
if (empty($v)) {
continue;
}
$arr[$k] = $v;
}
return json_encode($arr);
}
}