@@ -74,7 +74,7 @@ |
||
| 74 | 74 | }); |
| 75 | 75 | $resolver->setAllowedTypes("stat", ["string", "null"]); |
| 76 | 76 | $resolver->setAllowedValues("stat", function(?string $value) { |
| 77 | - return is_null($value) OR in_array($value, $this->getAllowedStats(), true); |
|
| 77 | + return is_null($value) or in_array($value, $this->getAllowedStats(), true); |
|
| 78 | 78 | }); |
| 79 | 79 | $resolver->setAllowedTypes("value", "integer"); |
| 80 | 80 | $resolver->setAllowedValues("value", function(int $value) { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | public const STAT_DODGE = "dodge"; |
| 33 | 33 | public const STAT_INITIATIVE = "initiative"; |
| 34 | 34 | /** @var string[] */ |
| 35 | - public const NO_STAT_TYPES = [self::TYPE_STUN, self::TYPE_POISON,]; |
|
| 35 | + public const NO_STAT_TYPES = [self::TYPE_STUN, self::TYPE_POISON, ]; |
|
| 36 | 36 | |
| 37 | 37 | /** @var string */ |
| 38 | 38 | protected $type; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | protected function configureOptions(OptionsResolver $resolver): void { |
| 68 | 68 | parent::configureOptions($resolver); |
| 69 | - $allStats = ["type", "stat", "value", "valueGrowth", "duration",]; |
|
| 69 | + $allStats = ["type", "stat", "value", "valueGrowth", "duration", ]; |
|
| 70 | 70 | $resolver->setRequired($allStats); |
| 71 | 71 | $resolver->setAllowedTypes("type", "string"); |
| 72 | 72 | $resolver->setAllowedValues("type", function(string $value) { |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | }); |
| 62 | 62 | $resolver->setAllowedTypes("type", ["string", "null"]); |
| 63 | 63 | $resolver->setAllowedValues("type", function(?string $value) { |
| 64 | - return is_null($value) OR in_array($value, $this->getAllowedTypes(), true); |
|
| 64 | + return is_null($value) or in_array($value, $this->getAllowedTypes(), true); |
|
| 65 | 65 | }); |
| 66 | 66 | $resolver->setAllowedTypes("strength", "integer"); |
| 67 | 67 | $resolver->setAllowedValues("strength", function(int $value) { |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | protected $worn; |
| 50 | 50 | |
| 51 | 51 | public function __construct(array $data) { |
| 52 | - $allStats = ["id", "name", "slot", "type", "strength", "worn",]; |
|
| 52 | + $allStats = ["id", "name", "slot", "type", "strength", "worn", ]; |
|
| 53 | 53 | $resolver = new OptionsResolver(); |
| 54 | 54 | $resolver->setRequired($allStats); |
| 55 | 55 | $resolver->setAllowedTypes("id", "integer"); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $resolver->setAllowedTypes("stat", "string"); |
| 53 | 53 | $resolver->setDefault("stat", ""); |
| 54 | 54 | $resolver->setAllowedValues("stat", function(string $value) { |
| 55 | - return $value === "" OR in_array($value, $this->getAllowedStats(), true); |
|
| 55 | + return $value === "" or in_array($value, $this->getAllowedStats(), true); |
|
| 56 | 56 | }); |
| 57 | 57 | $resolver->setAllowedTypes("source", "string"); |
| 58 | 58 | $resolver->setAllowedValues("source", function(string $value) { |
@@ -62,10 +62,10 @@ discard block |
||
| 62 | 62 | $resolver->setDefault("value", 0); |
| 63 | 63 | $resolver->setAllowedTypes("duration", ["string", "integer"]); |
| 64 | 64 | $resolver->setAllowedValues("duration", function($value) { |
| 65 | - return (in_array($value, $this->getDurations(), true)) OR ($value > 0); |
|
| 65 | + return (in_array($value, $this->getDurations(), true)) or ($value > 0); |
|
| 66 | 66 | }); |
| 67 | 67 | $effect = $resolver->resolve($effect); |
| 68 | - if(!in_array($effect["type"], SkillSpecial::NO_STAT_TYPES, true) AND $effect["stat"] === "") { |
|
| 68 | + if(!in_array($effect["type"], SkillSpecial::NO_STAT_TYPES, true) and $effect["stat"] === "") { |
|
| 69 | 69 | throw new \InvalidArgumentException("The option stat with value '' is invalid."); |
| 70 | 70 | } |
| 71 | 71 | $this->id = $effect["id"]; |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * @throws \InvalidArgumentException |
| 136 | 136 | */ |
| 137 | 137 | public function setDuration($value) { |
| 138 | - if(!is_int($value) AND !in_array($value, $this->getDurations(), true)) { |
|
| 138 | + if(!is_int($value) and !in_array($value, $this->getDurations(), true)) { |
|
| 139 | 139 | throw new \InvalidArgumentException("Invalid value set to CharacterEffect::\$duration. Expected string or integer."); |
| 140 | 140 | } |
| 141 | 141 | $this->duration = $value; |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | public $onRemove = []; |
| 47 | 47 | |
| 48 | 48 | public function __construct(array $effect) { |
| 49 | - $allStats = ["id", "type", "source", "value", "duration", "stat",]; |
|
| 49 | + $allStats = ["id", "type", "source", "value", "duration", "stat", ]; |
|
| 50 | 50 | $resolver = new OptionsResolver(); |
| 51 | 51 | $resolver->setRequired($allStats); |
| 52 | 52 | $resolver->setAllowedTypes("id", "string"); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | protected function getAllowedStats(): array { |
| 97 | 97 | $stats = Constants::getConstantsValues(SkillSpecial::class, "STAT_"); |
| 98 | - $stats = array_merge($stats, ["strength", "dexterity", "constitution", "intelligence", "charisma",]); |
|
| 98 | + $stats = array_merge($stats, ["strength", "dexterity", "constitution", "intelligence", "charisma", ]); |
|
| 99 | 99 | return $stats; |
| 100 | 100 | } |
| 101 | 101 | |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function getHitRate(): int { |
| 41 | - if(is_string($this->skill->hitRate) AND substr($this->skill->hitRate, -1) === "%") { |
|
| 41 | + if(is_string($this->skill->hitRate) and substr($this->skill->hitRate, -1) === "%") { |
|
| 42 | 42 | return (int) $this->skill->hitRate; |
| 43 | 43 | } |
| 44 | 44 | return 100; |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | public function damageStat(): string { |
| 498 | 498 | $stat = "strength"; |
| 499 | 499 | foreach($this->equipment as $item) { |
| 500 | - if(!$item->worn OR $item->slot != Equipment::SLOT_WEAPON) { |
|
| 500 | + if(!$item->worn or $item->slot != Equipment::SLOT_WEAPON) { |
|
| 501 | 501 | continue; |
| 502 | 502 | } |
| 503 | 503 | switch($item->type) { |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | $stat = $effect->stat; |
| 557 | 557 | $type = $effect->type; |
| 558 | 558 | $duration = $effect->duration; |
| 559 | - if(is_int($duration) AND $duration < 1) { |
|
| 559 | + if(is_int($duration) and $duration < 1) { |
|
| 560 | 560 | $this->removeEffect($effect->id); |
| 561 | 561 | continue; |
| 562 | 562 | } |
@@ -171,10 +171,10 @@ |
||
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | protected function setStats(array $stats): void { |
| 174 | - $requiredStats = ["id", "name", "level", "strength", "dexterity", "constitution", "intelligence", "charisma", "initiativeFormula",]; |
|
| 175 | - $allStats = array_merge($requiredStats, ["occupation", "race", "specialization", "gender", "experience",]); |
|
| 176 | - $numberStats = ["strength", "dexterity", "constitution", "intelligence", "charisma",]; |
|
| 177 | - $textStats = ["name", "race", "occupation", "initiativeFormula",]; |
|
| 174 | + $requiredStats = ["id", "name", "level", "strength", "dexterity", "constitution", "intelligence", "charisma", "initiativeFormula", ]; |
|
| 175 | + $allStats = array_merge($requiredStats, ["occupation", "race", "specialization", "gender", "experience", ]); |
|
| 176 | + $numberStats = ["strength", "dexterity", "constitution", "intelligence", "charisma", ]; |
|
| 177 | + $textStats = ["name", "race", "occupation", "initiativeFormula", ]; |
|
| 178 | 178 | $resolver = new OptionsResolver(); |
| 179 | 179 | $resolver->setDefined($allStats); |
| 180 | 180 | $resolver->setAllowedTypes("id", ["integer", "string"]); |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | */ |
| 76 | 76 | public function setTemplate(string $template): void { |
| 77 | 77 | if(!is_file($template)) { |
| 78 | - throw new \RuntimeException("File $template does not exist."); |
|
| 78 | + throw new \RuntimeException("file $template does not exist."); |
|
| 79 | 79 | } |
| 80 | 80 | $this->template = $template; |
| 81 | 81 | } |
@@ -2,8 +2,8 @@ |
||
| 2 | 2 | declare(strict_types=1); |
| 3 | 3 | |
| 4 | 4 | require __DIR__ . "/../vendor/autoload.php"; |
| 5 | -Testbench\Bootstrap::setup(__DIR__ . '/_temp', function (\Nette\Configurator $configurator) { |
|
| 6 | - $configurator->addParameters(["appDir" => __DIR__,]); |
|
| 5 | +Testbench\Bootstrap::setup(__DIR__ . '/_temp', function(\Nette\Configurator $configurator) { |
|
| 6 | + $configurator->addParameters(["appDir" => __DIR__, ]); |
|
| 7 | 7 | $configurator->addConfig(__DIR__ . "/tests.neon"); |
| 8 | 8 | }); |
| 9 | 9 | ?> |
| 10 | 10 | \ No newline at end of file |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | protected $message; |
| 47 | 47 | |
| 48 | 48 | public function __construct(ITranslator $translator, array $action) { |
| 49 | - $requiredStats = ["action", "result", "character1", "character2",]; |
|
| 49 | + $requiredStats = ["action", "result", "character1", "character2", ]; |
|
| 50 | 50 | $resolver = new OptionsResolver(); |
| 51 | - $resolver->setDefined(["amount", "name",]); |
|
| 51 | + $resolver->setDefined(["amount", "name", ]); |
|
| 52 | 52 | $resolver->setRequired($requiredStats); |
| 53 | 53 | $resolver->setAllowedTypes("action", "string"); |
| 54 | 54 | $resolver->setAllowedValues("action", function(string $value) { |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $text = $this->translator->translate("combat.log.poison", $this->amount, ["character1" => $character1]); |
| 151 | 151 | break; |
| 152 | 152 | } |
| 153 | - $this->message = $text; |
|
| 153 | + $this->message = $text; |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | public function __toString(): string { |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | |
| 49 | 49 | protected function configureOptions(OptionsResolver $resolver): void { |
| 50 | 50 | parent::configureOptions($resolver); |
| 51 | - $allStats = ["baseDamage", "damageGrowth", "strikes", "hitRate",]; |
|
| 51 | + $allStats = ["baseDamage", "damageGrowth", "strikes", "hitRate", ]; |
|
| 52 | 52 | $resolver->setRequired($allStats); |
| 53 | 53 | $resolver->setAllowedTypes("baseDamage", "string"); |
| 54 | 54 | $resolver->setAllowedTypes("damageGrowth", "string"); |