setValidRange($range); $this->setEffectValue($level); $this->value->addValues(...$args); } /** * Sets a range for validation. * * @param array $range The range including min and max values. * * @return $this * * @internal */ public function setValidRange($range) { $this->range = $range; return $this; } /** * Internal setter of the effect value. * * @param mixed $value The value to set. * * @return LimitedEffectQualifier * * @internal */ public function setEffectValue($value) { if (is_numeric($value) && ! empty($this->range) && ($value < $this->range[0] || $value > $this->range[1])) { throw new OutOfRangeException("Value must be in range: [{$this->range[0]}, {$this->range[1]}]"); } parent::setEffectValue($value); return $this; } }