DrdPlus/Theurgist/Spells/SpellParameters/Evocation.php
<?php
declare(strict_types = 1);
namespace DrdPlus\Theurgist\Spells\SpellParameters;
use DrdPlus\Tables\Measurements\Time\Time;
use DrdPlus\Tables\Measurements\Time\TimeBonus;
use DrdPlus\Tables\Measurements\Time\TimeTable;
use DrdPlus\Theurgist\Spells\SpellParameters\Partials\PositiveCastingParameter;
/**
* @method Evocation getWithAddition($additionValue)
*/
class Evocation extends PositiveCastingParameter
{
/**
* @param array $values
* @throws \DrdPlus\Theurgist\Spells\SpellParameters\Partials\Exceptions\InvalidValueForPositiveCastingParameter
* @throws \DrdPlus\Theurgist\Spells\SpellParameters\Partials\Exceptions\MissingValueForFormulaDifficultyAddition
* @throws \DrdPlus\Theurgist\Spells\SpellParameters\Exceptions\InvalidFormatOfDifficultyIncrement
* @throws \DrdPlus\Theurgist\Spells\SpellParameters\Exceptions\InvalidFormatOfAdditionByDifficultyValue
* @throws \DrdPlus\Theurgist\Spells\SpellParameters\Exceptions\InvalidFormatOfAdditionByDifficultyNotation
*/
public function __construct(array $values)
{
if (!array_key_exists(1, $values)) {
$values[1] = 0; // no addition by realms
}
parent::__construct($values);
}
/**
* @param TimeTable $timeTable
* @return Time
* @throws \DrdPlus\Tables\Measurements\Time\Exceptions\CanNotConvertThatBonusToTime
*/
public function getEvocationTime(TimeTable $timeTable): Time
{
/** @noinspection ExceptionsAnnotatingAndHandlingInspection */
return (new TimeBonus($this->getValue(), $timeTable))->getTime();
}
}