energy = $energy; $this->maxenergy = $max; } public function getEnergy(): int { return $this->energy; } public function setEnergy(int $energy) { if ($energy <= 0) { $energy = 0; } if ($energy > $this->maxenergy) { $energy = $this->maxenergy; } $this->energy = $energy; } public function getMaxEnergy(): int { return $this->maxenergy; } public function setMaxEnergy(int $maxenergy) { if ($maxenergy < 0) { $maxenergy = 0; } if ($this->energy > $maxenergy) { $this->energy = $maxenergy; } $this->maxenergy = $maxenergy; } }