Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions config/coverage-evidence.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
"src/MTGPocket/Game/TextParser.php": {
"pr375": "0cd33d1f46a420073ce8ce6f3db6875deea109cd0654869c86cd959ce2450bdf",
"main": "cb56be75277087578ee54849c1cf65003980604be27a7e161c30ba2433ac5d86",
"integrated": "740f15bb33390039531c3d352bd3bdbe9215bd31e78b5eb66496027f1027e63e"
"integrated": "322f902d16cc7b56583ba8b060b0251ee28e6c5f018435a2a81d0c1789185aa7"
},
"tests/Game/ModernCardTextTest.php": {
"pr375": "e62cfe938952097227ed0a8c76177aa98106e80c7eded44c7be7aebb1f0dadbf",
"main": "548ee1aef8132bdb27c496553736dfba743a4c07b2a417979e86d6af01c4d69c",
"integrated": "548ee1aef8132bdb27c496553736dfba743a4c07b2a417979e86d6af01c4d69c"
"main": "01b24cf186e9fca4981843105c2ed4c181579787fe637315a353ab56223cb080",
"integrated": "01b24cf186e9fca4981843105c2ed4c181579787fe637315a353ab56223cb080"
}
},
"historicalValidation": [
Expand Down Expand Up @@ -57,9 +57,9 @@
}
},
"sourcePins": {
"src/MTGPocket/Game/TextParser.php": "740f15bb33390039531c3d352bd3bdbe9215bd31e78b5eb66496027f1027e63e",
"src/MTGPocket/Game/TextParser.php": "322f902d16cc7b56583ba8b060b0251ee28e6c5f018435a2a81d0c1789185aa7",
"src/MTGPocket/Game/CardDefinition.php": "0af8c9d6c854c7ce44a0bde36298ad2780c33f42972be5d844f1cbdb43e098e7",
"src/MTGPocket/Game/Game.php": "5d7a9d62dce911ef6409c8e352c0547966cd751ae85341fabe4566b7125e4115",
"src/MTGPocket/Game/Game.php": "0cc57f469b750be0cbf44a094a8b3174234d9fe679bf9b8cdcf8daa8f6decf05",
"tests/Game/DepartingPermanentAbilityTest.php": "f3fe87cacb29081cbb9413b7280921cb8c013c279ff9cf59189c5c16df2d2f7c",
"tests/Game/DepartureCreatureStatusTest.php": "c0306ee7d419814c0aefcd524724135d5f714e41fa38750f366df2b09ab77f7b",
"src/MTGPocket/Game/Step.php": "25c8efe18d4221045bcb75a8f30c223d802e534b263a6722416dbc08d78f84e3",
Expand All @@ -86,7 +86,7 @@
"tests/Game/ArtifactGraveyardObserverTest.php": "296e0bee3502974562a61b346d81baf43d5510b4d9d0012171efde5546648c81",
"tests/Game/DepartedSourceStatisticsTest.php": "d077746e44bff3554407376f95e1b20ba7b00fc29f8a409927b68d964fd9241a",
"tests/Game/FabricateChoiceTest.php": "ddd05a50cdc5608f4e189ef53699875420113e73d6848cc6e4a64ea773a070ea",
"tests/Game/ModernCardTextTest.php": "548ee1aef8132bdb27c496553736dfba743a4c07b2a417979e86d6af01c4d69c",
"tests/Game/ModernCardTextTest.php": "01b24cf186e9fca4981843105c2ed4c181579787fe637315a353ab56223cb080",
"tests/Game/DiscipleBurialChoiceTest.php": "e7a2803eb0fe908b67d782d7a882cdd5e711dc8a3d6182747395cffeb53bb4f3",
"tests/AbilityCandidatesTest.php": "6b7a382e2a7aeddfdad38212dc8afa4afa5287e0d5ece4f5b088167db3e9be06",
"tests/Game/FangrenBurialChoiceTest.php": "be9c8ac2147f7ae37afc158bb2a86114c3cfee3255580a504108d4f3c9514785",
Expand Down
10 changes: 6 additions & 4 deletions src/MTGPocket/Game/Game.php
Original file line number Diff line number Diff line change
Expand Up @@ -9390,10 +9390,12 @@ private function putOntoBattlefield(GameObject $object, int $controller, bool $t
if ($card->entersWithMinusCounters > 0) {
$object->addCounters('-1/-1', $card->entersWithMinusCounters);
}
// `Each other creature (Elf) you control enters with an additional +1/+1 counter on it.`
foreach ($this->isCreature($object) ? $this->permanents($controller) : [] as $permanent) {
foreach ($permanent->id !== $object->id ? $this->keywords($permanent) : [] as $word) {
if (str_starts_with($word, 'others enter with counter ') && (($kind = substr($word, 26)) === 'Creature' || in_array($kind, $card->subtypes, true) || in_array('changeling', $card->keywords, true))) {
// `Each other creature (Elf, non-Human creature) you control enters with an additional +1/+1 counter on it.`, `Creatures you control enter …`: itself too.
$sources = array_filter($this->permanents($controller), fn (GameObject $o) => $o->id !== $object->id);
foreach ($this->isCreature($object) ? [...$sources, $object] : [] as $permanent) {
foreach ($this->keywords($permanent) as $word) {
if (preg_match('/^(others|creatures) enter with counter (non-)?(\w+)$/', $word, $m) && ($m[1] === 'creatures' || $permanent->id !== $object->id)
&& ($m[3] === 'Creature' || (in_array($m[3], $card->subtypes, true) || in_array('changeling', $card->keywords, true)) !== ($m[2] === 'non-'))) {
$object->addCounters('+1/+1', 1);
}
}
Expand Down
9 changes: 5 additions & 4 deletions src/MTGPocket/Game/TextParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -633,10 +633,11 @@ public static function parse(CardDefinition $card): array

continue;
}
// `Each other creature you control enters with an additional +1/+1 counter on it.`, `… other Elf …`; see Game::putOntoBattlefield().
if (! $spell && preg_match('/^Each other (creature|[A-Z][a-z]+(?: creature)?) you control enters(?: the battlefield)? with an additional \+1\/\+1 counter on it\.$/', $line, $match)
&& ($kind = $match[1] === 'creature' ? 'Creature' : self::subtypeOf(explode(' ', $match[1])[0])) !== null) {
$result['keywords'][] = "others enter with counter {$kind}";
// `Each other creature you control enters with an additional +1/+1 counter on it.`, `… other Elf …`, `… other non-Human creature …`,
// and `Creatures you control enter with an additional +1/+1 counter on them.`, itself included; see Game::putOntoBattlefield().
if (! $spell && preg_match('/^(?:Each (other )?(creature|(non-)?[A-Z][a-z]+(?: creature)?) you control enters|(Creatures) you control enter)(?: the battlefield)? with an additional \+1\/\+1 counter on (?:it|them)\.$/', $line, $match)
&& ($kind = in_array($match[2], ['creature', ''], true) ? 'Creature' : self::subtypeOf(explode(' ', substr($match[2], strlen($match[3] ?? '')))[0])) !== null) {
$result['keywords'][] = ($match[1] !== '' ? 'others' : 'creatures').' enter with counter '.($match[3] ?? '').$kind;

continue;
}
Expand Down
Loading
Loading