|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace AardsGerds\Game\Build\Talent\SecretKnowledge; |
|
6
|
|
|
|
|
7
|
|
|
use AardsGerds\Game\Shared\IntegerValue; |
|
8
|
|
|
use AardsGerds\Game\Shared\IntegerValueException; |
|
9
|
|
|
|
|
10
|
|
|
final class Ascension extends IntegerValue |
|
11
|
|
|
{ |
|
12
|
|
|
public const FIRST_ASCENSION = 1; |
|
13
|
|
|
public const SECOND_ASCENSION = 2; |
|
14
|
|
|
public const THIRD_ASCENSION = 3; |
|
15
|
|
|
public const FOURTH_ASCENSION = 4; |
|
16
|
|
|
public const FIFTH_ASCENSION = 5; |
|
17
|
|
|
public const SIXTH_ASCENSION = 6; |
|
18
|
|
|
public const SEVENTH_ASCENSION = 7; |
|
19
|
|
|
public const EIGHTH_ASCENSION = 8; |
|
20
|
|
|
|
|
21
|
|
|
public static function firstAscension(): self |
|
22
|
|
|
{ |
|
23
|
|
|
return new self(self::FIRST_ASCENSION); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public static function secondAscension(): self |
|
27
|
|
|
{ |
|
28
|
|
|
return new self(self::SECOND_ASCENSION); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public static function thirdAscension(): self |
|
32
|
|
|
{ |
|
33
|
|
|
return new self(self::THIRD_ASCENSION); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
public static function fourthAscension(): self |
|
37
|
|
|
{ |
|
38
|
|
|
return new self(self::FOURTH_ASCENSION); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public static function fifthAscension(): self |
|
42
|
|
|
{ |
|
43
|
|
|
return new self(self::FIFTH_ASCENSION); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public static function sixthAscension(): self |
|
47
|
|
|
{ |
|
48
|
|
|
return new self(self::SIXTH_ASCENSION); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public static function seventhAscension(): self |
|
52
|
|
|
{ |
|
53
|
|
|
return new self(self::SEVENTH_ASCENSION); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public static function eighthAscension(): self |
|
57
|
|
|
{ |
|
58
|
|
|
return new self(self::EIGHTH_ASCENSION); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function __toString(): string |
|
62
|
|
|
{ |
|
63
|
|
|
return match ($this->value) { |
|
64
|
|
|
self::FIRST_ASCENSION => 'First Ascension', |
|
65
|
|
|
self::SECOND_ASCENSION => 'Second Ascension', |
|
66
|
|
|
self::THIRD_ASCENSION => 'Third Ascension', |
|
67
|
|
|
self::FOURTH_ASCENSION => 'Fourth Ascension', |
|
68
|
|
|
self::FIFTH_ASCENSION => 'Fifth Ascension', |
|
69
|
|
|
self::SIXTH_ASCENSION => 'Sixth Ascension', |
|
70
|
|
|
self::SEVENTH_ASCENSION => 'Seventh Ascension', |
|
71
|
|
|
self::EIGHTH_ASCENSION => 'Eighth Ascension', |
|
72
|
|
|
default => throw IntegerValueException::invalidValue($this->value), |
|
73
|
|
|
}; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
protected function validate(): void |
|
77
|
|
|
{ |
|
78
|
|
|
if (!in_array($this->value, range(self::FIRST_ASCENSION, self::EIGHTH_ASCENSION))) { |
|
79
|
|
|
throw IntegerValueException::invalidValue($this->value); |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
} |
|
83
|
|
|
|