Lines
100.00%
5 / 5
Methods
100.00%
3 / 3
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| describe | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| play | 100.00% | 3 / 3 | 100.00% | 1 / 1 | 2 | ||
| 14 | final readonly class AcceptQuest implements Action | |
| 15 | { | |
| 16 | public function __construct( | |
| 17 | public QuestId $quest, | |
| 18 | ) {} | |
| 19 | ||
| 20 | #[Override] | |
| 21 | public function describe(): string | |
| 22 | { | |
| 23 | return "Accept quest {$this->quest->value}"; | |
| 24 | } | |
| 25 | ||
| 26 | #[Override] | |
| 27 | public function play(StepScript $bot): Generator | |
| 28 | { | |
| 29 | $accepting = $bot->accept($this->quest); | |
| 30 | yield from $accepting; | |
| 31 | ||
| 32 | return $accepting->getReturn() ? null : new Failed('the game would not give the quest'); | |
| 33 | } | |
| 34 | } |