'basic_medicine', 'fracture' => 'bone_setting', 'infection' => 'healing_herbs', 'poison' => 'antidote', 'burn' => 'burn_salve', 'malnourished' => 'food', // Cured by having enough food 'old-age' => null // Cannot be cured ]; public function __construct($id, $koboldId, $injuryType, $category, $severity) { $this->id = $id; $this->koboldId = $koboldId; $this->injuryType = $injuryType; $this->category = $category; $this->severity = $severity; } public static function load($id) { $db = Database::getInstance(); $pdo = $db->getPDO(); $stmt = $pdo->prepare("SELECT * FROM injuries WHERE id = ?"); $stmt->execute([$id]); $row = $stmt->fetch(); if (!$row) { return null; } return new self($row['id'], $row['kobold_id'], $row['injury_type'], $row['category'], $row['severity']); } public function getId() { return $this->id; } public function getInjuryType() { return $this->injuryType; } public function getCategory() { return $this->category; } public function getSeverity() { return $this->severity; } public function canBeCured() { return isset(self::$cureMap[$this->category]) && self::$cureMap[$this->category] !== null; } public function getRequiredMedicine() { return self::$cureMap[$this->category] ?? null; } public function getDescription() { return ucfirst(str_replace('_', ' ', $this->injuryType)); } public function delete() { $db = Database::getInstance(); $pdo = $db->getPDO(); $stmt = $pdo->prepare("DELETE FROM injuries WHERE id = ?"); $stmt->execute([$this->id]); } }