feat: support curated abilities and objective victory
This commit is contained in:
committed by
Keith Solomon
parent
088e85c9b4
commit
6befe7b3e2
@@ -112,6 +112,15 @@ final readonly class UnitState
|
||||
return $this->copy(health: max(0, $this->health - max(0, $damage)));
|
||||
}
|
||||
|
||||
public function restoreHealth(int $amount): self
|
||||
{
|
||||
if ($amount < 0) {
|
||||
throw new InvalidArgumentException('Restore health amount cannot be negative.');
|
||||
}
|
||||
|
||||
return $this->copy(health: min($this->maxHealth, $this->health + $amount));
|
||||
}
|
||||
|
||||
public function markAttacked(): self
|
||||
{
|
||||
return $this->copy(hasAttacked: true);
|
||||
|
||||
Reference in New Issue
Block a user