*/ private const TARGETS = [self::TARGET_SELF, self::TARGET_ALLY, self::TARGET_ENEMY, self::TARGET_TILE]; /** @var list */ private const EFFECTS = [self::EFFECT_RESTORE_HEALTH, self::EFFECT_DEAL_DAMAGE, self::EFFECT_APPLY_BUFF]; public function __construct( public AbilityId $id, public string $label, public int $range, public int $areaRadius, public string $target, public string $effect, public int $effectValue, ) { if ($this->range < 0) { throw new InvalidArgumentException('Ability range cannot be negative.'); } if ($this->areaRadius < 0) { throw new InvalidArgumentException('Ability area radius cannot be negative.'); } if (!in_array($this->target, self::TARGETS, true)) { throw new InvalidArgumentException("Unknown ability target: {$this->target}."); } if (!in_array($this->effect, self::EFFECTS, true)) { throw new InvalidArgumentException("Unknown ability effect: {$this->effect}."); } } }