From 247d5dc46153f1c6c8cf364c749b95030c082b66 Mon Sep 17 00:00:00 2001 From: Sky Johnson Date: Sat, 21 Dec 2024 17:46:29 -0600 Subject: [PATCH] Add math and classes to install --- src/actions/install.php | 30 ++++++++++++++++++++++++++++++ src/math.php | 18 +++++++++--------- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/src/actions/install.php b/src/actions/install.php index 194d267..df4be8a 100644 --- a/src/actions/install.php +++ b/src/actions/install.php @@ -174,6 +174,35 @@ function second() $page .= table_status_msg($query === true, 'Drops', 'populate'); + $query = db()->exec(<<exec(<<exec(<< 5) throw new \InvalidArgumentException("Growth rate must be between 0 and 5"); + if ($growth_rate < 0 || $growth_rate > 5) throw new \InvalidArgumentException("Growth rate must be between 0 and 5"); - return match($growthRate) { + return match($growth_rate) { 0 => calculate_erratic_exp($level), 1 => (4 * pow($level, 3)) / 5, 2 => pow($level, 3), @@ -71,9 +71,9 @@ function calculate_points(int $base_points, int $level, int $mode = 2): int if ($level < 1) throw new \InvalidArgumentException("Level must be 1 or greater"); $growth_multiplier = match($mode) { - 1 => 0.75, - 2 => 1.0, - 3 => 1.5, + 1 => 0.15, + 2 => 0.3, + 3 => 0.6, default => throw new \InvalidArgumentException("Invalid mode. Use 1 (weak), 2 (normal), or 3 (strong)") }; @@ -88,9 +88,9 @@ function calculate_stat(int $base_stat, int $level, int $mode = 2): int if ($level < 1) throw new \InvalidArgumentException("Level must be 1 or greater"); $growth_multiplier = match($mode) { - 1 => 0.75, - 2 => 1.0, - 3 => 1.5, + 1 => 0.15, + 2 => 0.3, + 3 => 0.6, default => throw new \InvalidArgumentException("Invalid mode. Use 1 (weak), 2 (normal), or 3 (strong)") };