| 1 | <?php |
| 2 | |
| 3 | require_once __DIR__ . '/../../src/Database/Database.php'; |
| 4 | |
| 5 | class Injury |
| 6 | { |
| 7 | private static $cureMap = [ |
| 8 | 'disease' => 'medicine', |
| 9 | 'cut' => 'bandage', |
| 10 | 'bruise' => 'bruise-salve', |
| 11 | 'fracture' => 'bone-setting', |
| 12 | 'infection' => 'healing-herbs', |
| 13 | 'poison' => 'antidote', |
| 14 | 'burn' => 'burn-salve', |
| 15 | 'malnourished' => 'food', // Cured by having enough food |
| 16 | 'old-age' => null // Cannot be cured |
| 17 | ]; |
| 18 | |
| 19 | public static function getCureForCategory($category) |
| 20 | { |
| 21 | return self::$cureMap[$category] ?? null; |
| 22 | } |
| 23 | |
| 24 | public static function getStatRequiredToCure($severity) |
| 25 | { |
| 26 | if ($severity === null) { |
| 27 | return null; |
| 28 | } |
| 29 | |
| 30 | $sev = (int) $severity; |
| 31 | if ($sev <= 0) { |
| 32 | return 0; |
| 33 | } |
| 34 | |
| 35 | return $severity * 20; |
| 36 | } |
| 37 | } |