diff --git a/app/Region/Standard/GanonsTower.php b/app/Region/Standard/GanonsTower.php index 921eb489d..74c0f754a 100644 --- a/app/Region/Standard/GanonsTower.php +++ b/app/Region/Standard/GanonsTower.php @@ -394,25 +394,35 @@ public function initalize() $this->prize_location->setRequirements($this->can_complete); $this->can_enter = function ($locations, $items) { - return $items->has('RescueZelda') - && ($this->world->config('itemPlacement') !== 'basic' - || (($this->world->config('mode.weapons') === 'swordless' || $items->hasSword(2)) && $items->hasHealth(12) && ($items->hasBottle(2) || $items->hasArmor()))) - && ((($items->has('MoonPearl') || ($this->world->config('canOWYBA', false) && $items->hasABottle())) - && (((($items->has('Crystal1') - + $items->has('Crystal2') - + $items->has('Crystal3') - + $items->has('Crystal4') - + $items->has('Crystal5') - + $items->has('Crystal6') - + $items->has('Crystal7')) >= $this->world->config('crystals.tower', 7)) + $playerCrystalCount = ( + $items->has('Crystal1') + + $items->has('Crystal2') + + $items->has('Crystal3') + + $items->has('Crystal4') + + $items->has('Crystal5') + + $items->has('Crystal6') + + $items->has('Crystal7') + ); + + return $items->has('RescueZelda') + && ($this->world->config('itemPlacement') !== 'basic' + || (($this->world->config('mode.weapons') === 'swordless' || $items->hasSword(2)) && $items->hasHealth(12) && ($items->hasBottle(2) || $items->hasArmor()))) + && ( + (($items->has('MoonPearl') || ($this->world->config('canOWYBA', false) && $items->hasABottle())) + && ((($playerCrystalCount >= $this->world->config('crystals.tower', 7)) && $this->world->getRegion('East Dark World Death Mountain')->canEnter($locations, $items)) || ((($this->world->config('canBootsClip', false) && $items->has('PegasusBoots')) || ($this->world->config('canSuperSpeed', false) && $items->has('PegasusBoots') && $items->has('Hookshot'))) && $this->world->getRegion('West Dark World Death Mountain')->canEnter($locations, $items)))) + || ($this->world->config('canOneFrameClipOW', false) && ($this->world->config('canDungeonRevive', false) || $items->has('MoonPearl') - || ($this->world->config('canOWYBA', false) && $items->hasABottle())))); + || ($this->world->config('canOWYBA', false) && $items->hasABottle()))) + || (($playerCrystalCount >= $this->world->config('crystals.tower', 7)) && + $this->world->getRegion('East Dark World Death Mountain')->canEnter($locations, $items) && + ($this->world->config('canDungeonRevive', false))) + ); }; return $this; diff --git a/tests/HybridMajorGlitches/GanonsTowerTest.php b/tests/HybridMajorGlitches/GanonsTowerTest.php new file mode 100644 index 000000000..cb292f690 --- /dev/null +++ b/tests/HybridMajorGlitches/GanonsTowerTest.php @@ -0,0 +1,318 @@ +world = World::factory('standard', ['difficulty' => 'test_rules', 'logic' => 'HybridMajorGlitches']); + $this->addCollected(['RescueZelda']); + $this->collected->setChecksForWorld($this->world->id); + } + + public function tearDown(): void { + parent::tearDown(); + unset($this->world); + } + + /** + * @param string $location + * @param bool $access + * @param array $items + * @param array $except + * + * @dataProvider accessPool + */ + public function testLocation(string $location, bool $access, array $items, array $except = []) { + if (count($except)) { + $this->collected = $this->allItemsExcept($except); + } + + $this->addCollected($items); + + $this->assertEquals($access, $this->world->getLocation($location) + ->canAccess($this->collected)); + } + + /** + * @param string $location + * @param bool $access + * @param string $item + * @param array $items + * @param array $except + * + * @dataProvider fillPool + */ + public function testFillLocation(string $location, bool $access, string $item, array $items = [], array $except = []) { + if (count($except)) { + $this->collected = $this->allItemsExcept($except); + } + + $this->addCollected($items); + + $this->assertEquals($access, $this->world->getLocation($location) + ->fill(Item::get($item, $this->world), $this->collected)); + } + + /** + * @param bool $access + * @param array $items + * @param array $except + * + * @dataProvider entryPool + */ + public function testEntry(bool $access, array $items, array $except = []) { + if (count($except)) { + $this->collected = $this->allItemsExcept($except); + } + + $this->addCollected($items); + + $this->assertEquals($access, $this->world->getRegion('Ganons Tower') + ->canEnter($this->world->getLocations(), $this->collected)); + } + + public function entryPool() { + return [ + [false, []], + [true, ['MoonPearl', 'PegasusBoots']], + [true, ['PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + [true, ['PegasusBoots', 'MoonPearl', 'ProgressiveGlove', 'ProgressiveGlove', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ]; + } + + public function fillPool() { + return [ + ["Ganon's Tower - Bob's Torch", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - DMs Room - Top Left", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - DMs Room - Top Right", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - DMs Room - Bottom Left", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - DMs Room - Bottom Right", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Randomizer Room - Top Left", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Randomizer Room - Top Right", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Randomizer Room - Bottom Left", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Randomizer Room - Bottom Right", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Firesnake Room", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Map Chest", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Big Chest", false, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Hope Room - Left", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Hope Room - Right", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Bob's Chest", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Tile Room", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Compass Room - Top Left", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Compass Room - Top Right", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Compass Room - Bottom Left", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Compass Room - Bottom Right", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Big Key Chest", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Big Key Room - Left", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Big Key Room - Right", true, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Mini Helmasaur Room - Left", false, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Mini Helmasaur Room - Right", false, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Pre-Moldorm Chest", false, 'BigKeyA2', [], ['BigKeyA2']], + + ["Ganon's Tower - Moldorm Chest", false, 'BigKeyA2', [], ['BigKeyA2']], + ]; + } + + public function accessPool() { + return [ + ["Ganon's Tower - Bob's Torch", false, []], + ["Ganon's Tower - Bob's Torch", false, [], ['PegasusBoots']], + ["Ganon's Tower - Bob's Torch", true, ['PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Bob's Torch", true, ['MoonPearl', 'PegasusBoots']], + + ["Ganon's Tower - DMs Room - Top Left", false, []], + ["Ganon's Tower - DMs Room - Top Left", false, [], ['Hammer']], + ["Ganon's Tower - DMs Room - Top Left", false, [], ['Hookshot']], + ["Ganon's Tower - DMs Room - Top Left", true, ['Hookshot', 'Hammer', 'PegasusBoots', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - DMs Room - Top Left", true, ['MoonPearl', 'Hookshot', 'Hammer', 'PegasusBoots']], + + ["Ganon's Tower - DMs Room - Top Right", false, []], + ["Ganon's Tower - DMs Room - Top Right", false, [], ['Hammer']], + ["Ganon's Tower - DMs Room - Top Right", false, [], ['Hookshot']], + ["Ganon's Tower - DMs Room - Top Right", true, ['Hookshot', 'Hammer', 'PegasusBoots', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - DMs Room - Top Right", true, ['MoonPearl', 'Hookshot', 'Hammer', 'PegasusBoots']], + + ["Ganon's Tower - DMs Room - Bottom Left", false, []], + ["Ganon's Tower - DMs Room - Bottom Left", false, [], ['Hammer']], + ["Ganon's Tower - DMs Room - Bottom Left", false, [], ['Hookshot']], + ["Ganon's Tower - DMs Room - Bottom Left", true, ['Hookshot', 'Hammer', 'PegasusBoots', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - DMs Room - Bottom Left", true, ['MoonPearl', 'Hookshot', 'Hammer', 'PegasusBoots']], + + ["Ganon's Tower - DMs Room - Bottom Right", false, []], + ["Ganon's Tower - DMs Room - Bottom Right", false, [], ['Hammer']], + ["Ganon's Tower - DMs Room - Bottom Right", false, [], ['Hookshot']], + ["Ganon's Tower - DMs Room - Bottom Right", true, ['Hookshot', 'Hammer', 'PegasusBoots', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - DMs Room - Bottom Right", true, ['MoonPearl', 'Hookshot', 'Hammer', 'PegasusBoots']], + + ["Ganon's Tower - Randomizer Room - Top Left", false, []], + ["Ganon's Tower - Randomizer Room - Top Left", false, [], ['Hammer']], + ["Ganon's Tower - Randomizer Room - Top Left", false, [], ['Hookshot']], + ["Ganon's Tower - Randomizer Room - Top Left", true, ['KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'Hookshot', 'Hammer', 'PegasusBoots', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Randomizer Room - Top Left", true, ['KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'Hookshot', 'Hammer', 'PegasusBoots']], + + ["Ganon's Tower - Randomizer Room - Top Right", false, []], + ["Ganon's Tower - Randomizer Room - Top Right", false, [], ['Hammer']], + ["Ganon's Tower - Randomizer Room - Top Right", false, [], ['Hookshot']], + ["Ganon's Tower - Randomizer Room - Top Right", true, ['KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'Hookshot', 'Hammer', 'PegasusBoots', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Randomizer Room - Top Right", true, ['KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'Hookshot', 'Hammer', 'PegasusBoots']], + + ["Ganon's Tower - Randomizer Room - Bottom Left", false, []], + ["Ganon's Tower - Randomizer Room - Bottom Left", false, [], ['Hammer']], + ["Ganon's Tower - Randomizer Room - Bottom Left", false, [], ['Hookshot']], + ["Ganon's Tower - Randomizer Room - Bottom Left", true, ['KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'Hookshot', 'Hammer', 'PegasusBoots', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Randomizer Room - Bottom Left", true, ['KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'Hookshot', 'Hammer', 'PegasusBoots']], + + ["Ganon's Tower - Randomizer Room - Bottom Right", false, []], + ["Ganon's Tower - Randomizer Room - Bottom Right", false, [], ['Hammer']], + ["Ganon's Tower - Randomizer Room - Bottom Right", false, [], ['Hookshot']], + ["Ganon's Tower - Randomizer Room - Bottom Right", true, ['KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'Hookshot', 'Hammer', 'PegasusBoots', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Randomizer Room - Bottom Right", true, ['KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'Hookshot', 'Hammer', 'PegasusBoots']], + + ["Ganon's Tower - Firesnake Room", false, []], + ["Ganon's Tower - Firesnake Room", false, [], ['Hammer']], + ["Ganon's Tower - Firesnake Room", false, [], ['Hookshot']], + ["Ganon's Tower - Firesnake Room", true, ['KeyA2', 'KeyA2', 'KeyA2', 'Hookshot', 'Hammer', 'PegasusBoots', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Firesnake Room", true, ['KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'Hookshot', 'Hammer', 'PegasusBoots']], + + ["Ganon's Tower - Map Chest", false, []], + ["Ganon's Tower - Map Chest", false, [], ['Hammer']], + ["Ganon's Tower - Map Chest", false, [], ['Hookshot', 'PegasusBoots']], + ["Ganon's Tower - Map Chest", true, ['KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'Hookshot', 'Hammer', 'PegasusBoots', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Map Chest", true, ['KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'Hookshot', 'Hammer', 'PegasusBoots']], + + ["Ganon's Tower - Big Chest", false, []], + ["Ganon's Tower - Big Chest", false, [], ['BigKeyA2']], + ["Ganon's Tower - Big Chest", true, ['BigKeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'Hookshot', 'CaneOfSomaria', 'FireRod', 'PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Big Chest", true, ['BigKeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'Hookshot', 'Hammer', 'PegasusBoots', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Big Chest", true, ['BigKeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'Hookshot', 'CaneOfSomaria', 'FireRod', 'PegasusBoots']], + ["Ganon's Tower - Big Chest", true, ['BigKeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'Hookshot', 'Hammer', 'PegasusBoots']], + + ["Ganon's Tower - Hope Room - Left", false, []], + ["Ganon's Tower - Hope Room - Left", true, ['PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Hope Room - Left", true, ['MoonPearl', 'PegasusBoots']], + + ["Ganon's Tower - Hope Room - Right", false, []], + ["Ganon's Tower - Hope Room - Right", true, ['PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Hope Room - Right", true, ['MoonPearl', 'PegasusBoots']], + + ["Ganon's Tower - Bob's Chest", false, []], + ["Ganon's Tower - Bob's Chest", true, ['KeyA2', 'KeyA2', 'KeyA2', 'CaneOfSomaria', 'FireRod', 'PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Bob's Chest", true, ['KeyA2', 'KeyA2', 'KeyA2', 'Hookshot', 'Hammer', 'PegasusBoots', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Bob's Chest", true, ['KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'CaneOfSomaria', 'FireRod', 'PegasusBoots']], + ["Ganon's Tower - Bob's Chest", true, ['KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'Hookshot', 'Hammer', 'PegasusBoots']], + + ["Ganon's Tower - Tile Room", false, []], + ["Ganon's Tower - Tile Room", false, [], ['CaneOfSomaria']], + ["Ganon's Tower - Tile Room", true, ['TitansMitt', 'CaneOfSomaria', 'PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Tile Room", true, ['MoonPearl', 'TitansMitt', 'CaneOfSomaria', 'PegasusBoots']], + + ["Ganon's Tower - Compass Room - Top Left", false, []], + ["Ganon's Tower - Compass Room - Top Left", false, [], ['CaneOfSomaria']], + ["Ganon's Tower - Compass Room - Top Left", false, [], ['FireRod']], + ["Ganon's Tower - Compass Room - Top Left", true, ['KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'FireRod', 'CaneOfSomaria', 'PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Compass Room - Top Left", true, ['KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'FireRod', 'MoonPearl', 'CaneOfSomaria', 'PegasusBoots']], + + ["Ganon's Tower - Compass Room - Top Right", false, []], + ["Ganon's Tower - Compass Room - Top Right", false, [], ['CaneOfSomaria']], + ["Ganon's Tower - Compass Room - Top Right", false, [], ['FireRod']], + ["Ganon's Tower - Compass Room - Top Right", true, ['KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'FireRod', 'CaneOfSomaria', 'PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Compass Room - Top Right", true, ['KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'FireRod', 'MoonPearl', 'CaneOfSomaria', 'PegasusBoots']], + + ["Ganon's Tower - Compass Room - Bottom Left", false, []], + ["Ganon's Tower - Compass Room - Bottom Left", false, [], ['CaneOfSomaria']], + ["Ganon's Tower - Compass Room - Bottom Left", false, [], ['FireRod']], + ["Ganon's Tower - Compass Room - Bottom Left", true, ['KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'FireRod', 'CaneOfSomaria', 'PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Compass Room - Bottom Left", true, ['KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'FireRod', 'MoonPearl', 'CaneOfSomaria', 'PegasusBoots']], + + ["Ganon's Tower - Compass Room - Bottom Right", false, []], + ["Ganon's Tower - Compass Room - Bottom Right", false, [], ['CaneOfSomaria']], + ["Ganon's Tower - Compass Room - Bottom Right", false, [], ['FireRod']], + ["Ganon's Tower - Compass Room - Bottom Right", true, ['KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'FireRod', 'CaneOfSomaria', 'PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Compass Room - Bottom Right", true, ['KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'FireRod', 'MoonPearl', 'CaneOfSomaria', 'PegasusBoots']], + + ["Ganon's Tower - Big Key Chest", false, []], + ["Ganon's Tower - Big Key Chest", true, ['UncleSword', 'KeyA2', 'KeyA2', 'KeyA2', 'CaneOfSomaria', 'FireRod', 'PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Big Key Chest", true, ['KeyA2', 'KeyA2', 'KeyA2', 'Hookshot', 'Hammer', 'PegasusBoots', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Big Key Chest", true, ['UncleSword', 'KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'CaneOfSomaria', 'FireRod', 'PegasusBoots']], + ["Ganon's Tower - Big Key Chest", true, ['KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'Hookshot', 'Hammer', 'PegasusBoots']], + + ["Ganon's Tower - Big Key Room - Left", false, []], + ["Ganon's Tower - Big Key Room - Left", true, ['UncleSword', 'KeyA2', 'KeyA2', 'KeyA2', 'CaneOfSomaria', 'FireRod', 'PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Big Key Room - Left", true, ['KeyA2', 'KeyA2', 'KeyA2', 'Hookshot', 'Hammer', 'PegasusBoots', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Big Key Room - Left", true, ['UncleSword', 'KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'CaneOfSomaria', 'FireRod', 'PegasusBoots']], + ["Ganon's Tower - Big Key Room - Left", true, ['KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'Hookshot', 'Hammer', 'PegasusBoots']], + + ["Ganon's Tower - Big Key Room - Right", false, []], + ["Ganon's Tower - Big Key Room - Right", true, ['UncleSword', 'KeyA2', 'KeyA2', 'KeyA2', 'CaneOfSomaria', 'FireRod', 'PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Big Key Room - Right", true, ['KeyA2', 'KeyA2', 'KeyA2', 'Hookshot', 'Hammer', 'PegasusBoots', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Big Key Room - Right", true, ['UncleSword', 'KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'CaneOfSomaria', 'FireRod', 'PegasusBoots']], + ["Ganon's Tower - Big Key Room - Right", true, ['KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'Hookshot', 'Hammer', 'PegasusBoots']], + + ["Ganon's Tower - Mini Helmasaur Room - Left", false, []], + ["Ganon's Tower - Mini Helmasaur Room - Left", false, [], ['AnyBow']], + ["Ganon's Tower - Mini Helmasaur Room - Left", false, [], ['BigKeyA2']], + ["Ganon's Tower - Mini Helmasaur Room - Left", true, ['BowAndArrows', 'BigKeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'Lamp', 'PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Mini Helmasaur Room - Left", true, ['BowAndArrows', 'BigKeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'FireRod', 'PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Mini Helmasaur Room - Left", true, ['BowAndArrows', 'BigKeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'Lamp', 'PegasusBoots']], + ["Ganon's Tower - Mini Helmasaur Room - Left", true, ['BowAndArrows', 'BigKeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'FireRod', 'PegasusBoots']], + + ["Ganon's Tower - Mini Helmasaur Room - Right", false, []], + ["Ganon's Tower - Mini Helmasaur Room - Right", false, [], ['AnyBow']], + ["Ganon's Tower - Mini Helmasaur Room - Right", false, [], ['BigKeyA2']], + ["Ganon's Tower - Mini Helmasaur Room - Right", true, ['BowAndArrows', 'BigKeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'Lamp', 'PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Mini Helmasaur Room - Right", true, ['BowAndArrows', 'BigKeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'FireRod', 'PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Mini Helmasaur Room - Right", true, ['BowAndArrows', 'BigKeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'Lamp', 'PegasusBoots']], + ["Ganon's Tower - Mini Helmasaur Room - Right", true, ['BowAndArrows', 'BigKeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'FireRod', 'PegasusBoots']], + + ["Ganon's Tower - Pre-Moldorm Chest", false, []], + ["Ganon's Tower - Pre-Moldorm Chest", false, [], ['AnyBow']], + ["Ganon's Tower - Pre-Moldorm Chest", false, [], ['BigKeyA2']], + ["Ganon's Tower - Pre-Moldorm Chest", true, ['BowAndArrows', 'BigKeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'Lamp', 'PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Pre-Moldorm Chest", true, ['BowAndArrows', 'BigKeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'FireRod', 'PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Pre-Moldorm Chest", true, ['BowAndArrows', 'BigKeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'Lamp', 'PegasusBoots']], + ["Ganon's Tower - Pre-Moldorm Chest", true, ['BowAndArrows', 'BigKeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'FireRod', 'PegasusBoots']], + + ["Ganon's Tower - Moldorm Chest", false, []], + ["Ganon's Tower - Moldorm Chest", false, [], ['Hookshot']], + ["Ganon's Tower - Moldorm Chest", false, [], ['AnyBow']], + ["Ganon's Tower - Moldorm Chest", false, [], ['BigKeyA2']], + ["Ganon's Tower - Moldorm Chest", true, ['BowAndArrows', 'UncleSword', 'BigKeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'Lamp', 'Hookshot', 'PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Moldorm Chest", true, ['BowAndArrows', 'UncleSword', 'BigKeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'Hookshot', 'FireRod', 'PegasusBoots', 'Hammer', 'Crystal1', 'Crystal2', 'Crystal3', 'Crystal4', 'Crystal5', 'Crystal6', 'Crystal7']], + ["Ganon's Tower - Moldorm Chest", true, ['BowAndArrows', 'UncleSword', 'BigKeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'Lamp', 'Hookshot', 'PegasusBoots']], + ["Ganon's Tower - Moldorm Chest", true, ['BowAndArrows', 'UncleSword', 'BigKeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'KeyA2', 'MoonPearl', 'Hookshot', 'FireRod', 'PegasusBoots']], + ]; + } +} \ No newline at end of file diff --git a/tests/HybridMajorGlitches/IcePalaceTest.php b/tests/HybridMajorGlitches/IcePalaceTest.php new file mode 100644 index 000000000..e11c31c73 --- /dev/null +++ b/tests/HybridMajorGlitches/IcePalaceTest.php @@ -0,0 +1,303 @@ +world = World::factory('standard', ['difficulty' => 'test_rules', 'logic' => 'HybridMajorGlitches']); + $this->addCollected(['RescueZelda']); + $this->collected->setChecksForWorld($this->world->id); + } + + public function tearDown(): void { + parent::tearDown(); + unset($this->world); + } + + /** + * @param string $location + * @param bool $access + * @param string $item + * @param array $items + * @param array $except + * + * @dataProvider fillPool + */ + public function testFillLocation(string $location, bool $access, string $item, array $items = [], array $except = []) { + if (count($except)) { + $this->collected = $this->allItemsExcept($except); + } + + $this->addCollected($items); + + $this->assertEquals($access, $this->world->getLocation($location) + ->fill(Item::get($item, $this->world), $this->collected)); + } + + public function fillPool() { + return [ + ["Ice Palace - Big Key Chest", true, 'BigKeyD5', [], ['BigKeyD5']], + + ["Ice Palace - Compass Chest", true, 'BigKeyD5', [], ['BigKeyD5']], + + ["Ice Palace - Map Chest", true, 'BigKeyD5', [], ['BigKeyD5']], + + ["Ice Palace - Spike Room", true, 'BigKeyD5', [], ['BigKeyD5']], + + ["Ice Palace - Freezor Chest", true, 'BigKeyD5', [], ['BigKeyD5']], + + ["Ice Palace - Iced T Room", true, 'BigKeyD5', [], ['BigKeyD5']], + + ["Ice Palace - Big Chest", false, 'BigKeyD5', [], ['BigKeyD5']], + + ["Ice Palace - Boss", false, 'BigKeyD5', [], ['BigKeyD5']], + ]; + } + + + /** + * @param string $location + * @param bool $access + * @param array $items + * @param array $except + * + * @dataProvider accessPool + */ + public function testLocation(string $location, bool $access, array $items, array $except = []) { + if (count($except)) { + $this->collected = $this->allItemsExcept($except); + } + + $this->addCollected($items); + + $this->assertEquals($access, $this->world->getLocation($location) + ->canAccess($this->collected)); + } + + public function accessPool() { + return [ + ["Ice Palace - Big Key Chest", false, []], + ["Ice Palace - Big Key Chest", false, [], ['Gloves']], + ["Ice Palace - Big Key Chest", false, [], ['Hammer']], + ["Ice Palace - Big Key Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'FireRod', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'UncleSword', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'ProgressiveSword', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'MasterSword', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L3Sword', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L4Sword', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'FireRod', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'UncleSword', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'ProgressiveSword', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'MasterSword', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L3Sword', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L4Sword', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'FireRod', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'UncleSword', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'ProgressiveSword', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'MasterSword', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L3Sword', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L4Sword', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'FireRod', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['TitansMitt', 'Bombos', 'UncleSword', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['TitansMitt', 'Bombos', 'ProgressiveSword', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['TitansMitt', 'Bombos', 'MasterSword', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['TitansMitt', 'Bombos', 'L3Sword', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['TitansMitt', 'Bombos', 'L4Sword', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['TitansMitt', 'FireRod', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['TitansMitt', 'Bombos', 'UncleSword', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['TitansMitt', 'Bombos', 'ProgressiveSword', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['TitansMitt', 'Bombos', 'MasterSword', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['TitansMitt', 'Bombos', 'L3Sword', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['TitansMitt', 'Bombos', 'L4Sword', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['TitansMitt', 'FireRod', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['TitansMitt', 'Bombos', 'UncleSword', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['TitansMitt', 'Bombos', 'ProgressiveSword', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['TitansMitt', 'Bombos', 'MasterSword', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['TitansMitt', 'Bombos', 'L3Sword', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Big Key Chest", true, ['TitansMitt', 'Bombos', 'L4Sword', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + + ["Ice Palace - Compass Chest", false, []], + ["Ice Palace - Compass Chest", true, ['ProgressiveGlove', 'ProgressiveGlove']], + ["Ice Palace - Compass Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'FireRod']], + ["Ice Palace - Compass Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'UncleSword']], + ["Ice Palace - Compass Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'ProgressiveSword']], + ["Ice Palace - Compass Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'MasterSword']], + ["Ice Palace - Compass Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L3Sword']], + ["Ice Palace - Compass Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L4Sword']], + ["Ice Palace - Compass Chest", true, ['TitansMitt', 'FireRod']], + ["Ice Palace - Compass Chest", true, ['TitansMitt', 'Bombos', 'UncleSword']], + ["Ice Palace - Compass Chest", true, ['TitansMitt', 'Bombos', 'ProgressiveSword']], + ["Ice Palace - Compass Chest", true, ['TitansMitt', 'Bombos', 'MasterSword']], + ["Ice Palace - Compass Chest", true, ['TitansMitt', 'Bombos', 'L3Sword']], + ["Ice Palace - Compass Chest", true, ['TitansMitt', 'Bombos', 'L4Sword']], + + ["Ice Palace - Map Chest", false, []], + ["Ice Palace - Map Chest", false, [], ['Gloves']], + ["Ice Palace - Map Chest", false, [], ['Hammer']], + ["Ice Palace - Map Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'FireRod', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'UncleSword', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'ProgressiveSword', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'MasterSword', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L3Sword', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L4Sword', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'FireRod', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'UncleSword', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'ProgressiveSword', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'MasterSword', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L3Sword', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L4Sword', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'FireRod', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'UncleSword', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'ProgressiveSword', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'MasterSword', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L3Sword', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L4Sword', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['TitansMitt', 'FireRod', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['TitansMitt', 'Bombos', 'UncleSword', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['TitansMitt', 'Bombos', 'ProgressiveSword', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['TitansMitt', 'Bombos', 'MasterSword', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['TitansMitt', 'Bombos', 'L3Sword', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['TitansMitt', 'Bombos', 'L4Sword', 'Hammer', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['TitansMitt', 'FireRod', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['TitansMitt', 'Bombos', 'UncleSword', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['TitansMitt', 'Bombos', 'ProgressiveSword', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['TitansMitt', 'Bombos', 'MasterSword', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['TitansMitt', 'Bombos', 'L3Sword', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['TitansMitt', 'Bombos', 'L4Sword', 'Hammer', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['TitansMitt', 'FireRod', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['TitansMitt', 'Bombos', 'UncleSword', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['TitansMitt', 'Bombos', 'ProgressiveSword', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['TitansMitt', 'Bombos', 'MasterSword', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['TitansMitt', 'Bombos', 'L3Sword', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Map Chest", true, ['TitansMitt', 'Bombos', 'L4Sword', 'Hammer', 'Cape', 'Hookshot', 'KeyD5']], + + ["Ice Palace - Spike Room", false, []], + ["Ice Palace - Spike Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'FireRod', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'UncleSword', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'ProgressiveSword', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'MasterSword', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L3Sword', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L4Sword', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'FireRod', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'UncleSword', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'ProgressiveSword', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'MasterSword', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L3Sword', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L4Sword', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'FireRod', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'UncleSword', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'ProgressiveSword', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'MasterSword', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L3Sword', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L4Sword', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['TitansMitt', 'FireRod', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['TitansMitt', 'Bombos', 'UncleSword', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['TitansMitt', 'Bombos', 'ProgressiveSword', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['TitansMitt', 'Bombos', 'MasterSword', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['TitansMitt', 'Bombos', 'L3Sword', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['TitansMitt', 'Bombos', 'L4Sword', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['TitansMitt', 'FireRod', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['TitansMitt', 'Bombos', 'UncleSword', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['TitansMitt', 'Bombos', 'ProgressiveSword', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['TitansMitt', 'Bombos', 'MasterSword', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['TitansMitt', 'Bombos', 'L3Sword', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['TitansMitt', 'Bombos', 'L4Sword', 'CaneOfByrna', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['TitansMitt', 'FireRod', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['TitansMitt', 'Bombos', 'UncleSword', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['TitansMitt', 'Bombos', 'ProgressiveSword', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['TitansMitt', 'Bombos', 'MasterSword', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['TitansMitt', 'Bombos', 'L3Sword', 'Cape', 'Hookshot', 'KeyD5']], + ["Ice Palace - Spike Room", true, ['TitansMitt', 'Bombos', 'L4Sword', 'Cape', 'Hookshot', 'KeyD5']], + + + + + ["Ice Palace - Freezor Chest", false, []], + ["Ice Palace - Freezor Chest", false, [], ['FireRod', 'Bombos', 'AnySword']], + ["Ice Palace - Freezor Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'FireRod']], + ["Ice Palace - Freezor Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'UncleSword']], + ["Ice Palace - Freezor Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'ProgressiveSword']], + ["Ice Palace - Freezor Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'MasterSword']], + ["Ice Palace - Freezor Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L3Sword']], + ["Ice Palace - Freezor Chest", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L4Sword']], + ["Ice Palace - Freezor Chest", true, ['TitansMitt', 'FireRod']], + ["Ice Palace - Freezor Chest", true, ['TitansMitt', 'Bombos', 'UncleSword']], + ["Ice Palace - Freezor Chest", true, ['TitansMitt', 'Bombos', 'ProgressiveSword']], + ["Ice Palace - Freezor Chest", true, ['TitansMitt', 'Bombos', 'MasterSword']], + ["Ice Palace - Freezor Chest", true, ['TitansMitt', 'Bombos', 'L3Sword']], + ["Ice Palace - Freezor Chest", true, ['TitansMitt', 'Bombos', 'L4Sword']], + + ["Ice Palace - Iced T Room", false, []], + ["Ice Palace - Iced T Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'FireRod']], + ["Ice Palace - Iced T Room", true, ['ProgressiveGlove', 'ProgressiveGlove']], + ["Ice Palace - Iced T Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'UncleSword']], + ["Ice Palace - Iced T Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'ProgressiveSword']], + ["Ice Palace - Iced T Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'MasterSword']], + ["Ice Palace - Iced T Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L3Sword']], + ["Ice Palace - Iced T Room", true, ['ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L4Sword']], + ["Ice Palace - Iced T Room", true, ['TitansMitt', 'FireRod']], + ["Ice Palace - Iced T Room", true, ['TitansMitt', 'Bombos', 'UncleSword']], + ["Ice Palace - Iced T Room", true, ['TitansMitt', 'Bombos', 'ProgressiveSword']], + ["Ice Palace - Iced T Room", true, ['TitansMitt', 'Bombos', 'MasterSword']], + ["Ice Palace - Iced T Room", true, ['TitansMitt', 'Bombos', 'L3Sword']], + ["Ice Palace - Iced T Room", true, ['TitansMitt', 'Bombos', 'L4Sword']], + + ["Ice Palace - Big Chest", false, []], + ["Ice Palace - Big Chest", false, [], ['BigKeyD5']], + ["Ice Palace - Big Chest", true, ['BigKeyD5', 'ProgressiveGlove', 'ProgressiveGlove']], + ["Ice Palace - Big Chest", true, ['BigKeyD5', 'ProgressiveGlove', 'ProgressiveGlove', 'FireRod']], + ["Ice Palace - Big Chest", true, ['BigKeyD5', 'ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'UncleSword']], + ["Ice Palace - Big Chest", true, ['BigKeyD5', 'ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'ProgressiveSword']], + ["Ice Palace - Big Chest", true, ['BigKeyD5', 'ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'MasterSword']], + ["Ice Palace - Big Chest", true, ['BigKeyD5', 'ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L3Sword']], + ["Ice Palace - Big Chest", true, ['BigKeyD5', 'ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L4Sword']], + ["Ice Palace - Big Chest", true, ['BigKeyD5', 'TitansMitt', 'FireRod']], + ["Ice Palace - Big Chest", true, ['BigKeyD5', 'TitansMitt', 'Bombos', 'UncleSword']], + ["Ice Palace - Big Chest", true, ['BigKeyD5', 'TitansMitt', 'Bombos', 'ProgressiveSword']], + ["Ice Palace - Big Chest", true, ['BigKeyD5', 'TitansMitt', 'Bombos', 'MasterSword']], + ["Ice Palace - Big Chest", true, ['BigKeyD5', 'TitansMitt', 'Bombos', 'L3Sword']], + ["Ice Palace - Big Chest", true, ['BigKeyD5', 'TitansMitt', 'Bombos', 'L4Sword']], + + ["Ice Palace - Boss", false, []], + ["Ice Palace - Boss", false, [], ['Gloves']], + ["Ice Palace - Boss", false, [], ['Hammer']], + ["Ice Palace - Boss", false, [], ['BigKeyD5']], + ["Ice Palace - Boss", false, [], ['FireRod', 'Bombos', 'AnySword']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'ProgressiveGlove', 'ProgressiveGlove', 'FireRod', 'Hammer', 'KeyD5', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'ProgressiveGlove', 'ProgressiveGlove', 'FireRod', 'Hammer', 'CaneOfSomaria', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'UncleSword', 'Hammer', 'KeyD5', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'UncleSword', 'Hammer', 'CaneOfSomaria', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'ProgressiveSword', 'Hammer', 'KeyD5', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'ProgressiveSword', 'Hammer', 'CaneOfSomaria', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'MasterSword', 'Hammer', 'KeyD5', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'MasterSword', 'Hammer', 'CaneOfSomaria', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L3Sword', 'Hammer', 'KeyD5', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L3Sword', 'Hammer', 'CaneOfSomaria', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L4Sword', 'Hammer', 'KeyD5', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'ProgressiveGlove', 'ProgressiveGlove', 'Bombos', 'L4Sword', 'Hammer', 'CaneOfSomaria', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'TitansMitt', 'FireRod', 'Hammer', 'KeyD5', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'TitansMitt', 'FireRod', 'Hammer', 'CaneOfSomaria', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'TitansMitt', 'Bombos', 'UncleSword', 'Hammer', 'KeyD5', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'TitansMitt', 'Bombos', 'UncleSword', 'Hammer', 'CaneOfSomaria', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'TitansMitt', 'Bombos', 'ProgressiveSword', 'Hammer', 'KeyD5', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'TitansMitt', 'Bombos', 'ProgressiveSword', 'Hammer', 'CaneOfSomaria', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'TitansMitt', 'Bombos', 'MasterSword', 'Hammer', 'KeyD5', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'TitansMitt', 'Bombos', 'MasterSword', 'Hammer', 'CaneOfSomaria', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'TitansMitt', 'Bombos', 'L3Sword', 'Hammer', 'KeyD5', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'TitansMitt', 'Bombos', 'L3Sword', 'Hammer', 'CaneOfSomaria', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'TitansMitt', 'Bombos', 'L4Sword', 'Hammer', 'KeyD5', 'KeyD5']], + ["Ice Palace - Boss", true, ['BigKeyD5', 'TitansMitt', 'Bombos', 'L4Sword', 'Hammer', 'CaneOfSomaria', 'KeyD5']], + ]; + } +} \ No newline at end of file diff --git a/tests/HybridMajorGlitches/PalaceOfDarknessTest.php b/tests/HybridMajorGlitches/PalaceOfDarknessTest.php new file mode 100644 index 000000000..ae21abb19 --- /dev/null +++ b/tests/HybridMajorGlitches/PalaceOfDarknessTest.php @@ -0,0 +1,209 @@ +world = World::factory('standard', ['difficulty' => 'test_rules', 'logic' => 'HybridMajorGlitches']); + $this->addCollected(['RescueZelda']); + $this->collected->setChecksForWorld($this->world->id); + } + + public function tearDown(): void { + parent::tearDown(); + unset($this->world); + } + + /** + * @param bool $access + * @param array $items + * @param array $except + * + * @dataProvider entryPool + */ + public function testEntry(bool $access, array $items, array $except = []) { + if (count($except)) { + $this->collected = $this->allItemsExcept($except); + } + + $this->addCollected($items); + + $this->assertEquals($access, $this->world->getRegion('Palace of Darkness') + ->canEnter($this->world->getLocations(), $this->collected)); + } + + public function entryPool() { + return [ + [false, []], + [false, ['MoonPearl']], + [true, ['PegasusBoots']], + [true, ['MoonPearl', 'PegasusBoots']], + [true, ['MoonPearl', 'ProgressiveGlove', 'ProgressiveGlove']], + [true, ['MoonPearl', 'TitansMitt']], + ]; + } + + /** + * @param string $location + * @param bool $access + * @param string $item + * @param array $items + * @param array $except + * + * @dataProvider fillPool + */ + public function testFillLocation(string $location, bool $access, string $item, array $items = [], array $except = []) { + if (count($except)) { + $this->collected = $this->allItemsExcept($except); + } + + $this->addCollected($items); + + $this->assertEquals($access, $this->world->getLocation($location) + ->fill(Item::get($item, $this->world), $this->collected)); + } + + public function fillPool() { + return [ + ["Palace of Darkness - Big Key Chest", true, 'BigKeyD1', [], ['BigKeyD1']], + ["Palace of Darkness - The Arena - Ledge", true, 'BigKeyD1', [], ['BigKeyD1']], + ["Palace of Darkness - The Arena - Bridge", true, 'BigKeyD1', [], ['BigKeyD1']], + ["Palace of Darkness - Big Chest", false, 'BigKeyD1', [], ['BigKeyD1']], + ["Palace of Darkness - Compass Chest", true, 'BigKeyD1', [], ['BigKeyD1']], + ["Palace of Darkness - Harmless Hellway", true, 'BigKeyD1', [], ['BigKeyD1']], + ["Palace of Darkness - Stalfos Basement", true, 'BigKeyD1', [], ['BigKeyD1']], + ["Palace of Darkness - Dark Basement - Left", true, 'BigKeyD1', [], ['BigKeyD1']], + ["Palace of Darkness - Dark Basement - Right", true, 'BigKeyD1', [], ['BigKeyD1']], + ["Palace of Darkness - Map Chest", true, 'BigKeyD1', [], ['BigKeyD1']], + ["Palace of Darkness - Dark Maze - Top", true, 'BigKeyD1', [], ['BigKeyD1']], + ["Palace of Darkness - Dark Maze - Bottom", true, 'BigKeyD1', [], ['BigKeyD1']], + ["Palace of Darkness - Shooter Room", true, 'BigKeyD1', [], ['BigKeyD1']], + ["Palace of Darkness - Boss", false, 'BigKeyD1', [], ['BigKeyD1']], + ]; + } + + + /** + * @param string $location + * @param bool $access + * @param array $items + * @param array $except + * + * @dataProvider accessPool + */ + public function testLocation(string $location, bool $access, array $items, array $except = []) { + if (count($except)) { + $this->collected = $this->allItemsExcept($except); + } + + $this->addCollected($items); + + $this->assertEquals($access, $this->world->getLocation($location) + ->canAccess($this->collected)); + } + + public function accessPool() { + return [ + ["Palace of Darkness - Big Key Chest", false, []], + ["Palace of Darkness - Big Key Chest", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'PegasusBoots']], + ["Palace of Darkness - Big Key Chest", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'MoonPearl', 'PegasusBoots']], + ["Palace of Darkness - Big Key Chest", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'MoonPearl', 'ProgressiveGlove', 'ProgressiveGlove']], + ["Palace of Darkness - Big Key Chest", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'MoonPearl', 'TitansMitt']], + + ["Palace of Darkness - The Arena - Ledge", false, []], + ["Palace of Darkness - The Arena - Ledge", false, [], ['AnyBow']], + ["Palace of Darkness - The Arena - Ledge", true, ['BowAndArrows', 'PegasusBoots']], + ["Palace of Darkness - The Arena - Ledge", true, ['BowAndArrows', 'MoonPearl', 'PegasusBoots']], + ["Palace of Darkness - The Arena - Ledge", true, ['BowAndArrows', 'MoonPearl', 'ProgressiveGlove', 'ProgressiveGlove']], + ["Palace of Darkness - The Arena - Ledge", true, ['BowAndArrows', 'MoonPearl', 'TitansMitt']], + + ["Palace of Darkness - The Arena - Bridge", false, []], + ["Palace of Darkness - The Arena - Bridge", true, ['KeyD1', 'PegasusBoots']], + ["Palace of Darkness - The Arena - Bridge", true, ['KeyD1', 'MoonPearl', 'PegasusBoots']], + ["Palace of Darkness - The Arena - Bridge", true, ['KeyD1', 'MoonPearl', 'ProgressiveGlove', 'ProgressiveGlove']], + ["Palace of Darkness - The Arena - Bridge", true, ['KeyD1', 'MoonPearl', 'TitansMitt']], + ["Palace of Darkness - The Arena - Bridge", true, ['BowAndArrows', 'Hammer', 'MoonPearl', 'PegasusBoots']], + + ["Palace of Darkness - Big Chest", false, []], + ["Palace of Darkness - Big Chest", false, [], ['Lamp']], + ["Palace of Darkness - Big Chest", false, [], ['BigKeyD1']], + ["Palace of Darkness - Big Chest", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'BigKeyD1', 'Lamp', 'PegasusBoots']], + ["Palace of Darkness - Big Chest", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'BigKeyD1', 'MoonPearl', 'Lamp', 'ProgressiveGlove', 'ProgressiveGlove']], + ["Palace of Darkness - Big Chest", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'BigKeyD1', 'MoonPearl', 'Lamp', 'TitansMitt']], + + ["Palace of Darkness - Compass Chest", false, []], + ["Palace of Darkness - Compass Chest", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'PegasusBoots']], + ["Palace of Darkness - Compass Chest", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'MoonPearl', 'PegasusBoots']], + ["Palace of Darkness - Compass Chest", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'MoonPearl', 'ProgressiveGlove', 'ProgressiveGlove']], + ["Palace of Darkness - Compass Chest", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'MoonPearl', 'TitansMitt']], + + ["Palace of Darkness - Harmless Hellway", false, []], + ["Palace of Darkness - Harmless Hellway", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'PegasusBoots']], + ["Palace of Darkness - Harmless Hellway", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'MoonPearl', 'PegasusBoots']], + ["Palace of Darkness - Harmless Hellway", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'MoonPearl', 'ProgressiveGlove', 'ProgressiveGlove']], + ["Palace of Darkness - Harmless Hellway", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'MoonPearl', 'TitansMitt']], + + ["Palace of Darkness - Stalfos Basement", false, []], + ["Palace of Darkness - Stalfos Basement", true, ['KeyD1', 'PegasusBoots']], + ["Palace of Darkness - Stalfos Basement", true, ['KeyD1', 'MoonPearl', 'PegasusBoots']], + ["Palace of Darkness - Stalfos Basement", true, ['KeyD1', 'MoonPearl', 'ProgressiveGlove', 'ProgressiveGlove']], + ["Palace of Darkness - Stalfos Basement", true, ['KeyD1', 'MoonPearl', 'TitansMitt']], + ["Palace of Darkness - Stalfos Basement", true, ['BowAndArrows', 'Hammer', 'MoonPearl', 'PegasusBoots']], + + ["Palace of Darkness - Dark Basement - Left", false, []], + ["Palace of Darkness - Dark Basement - Left", false, [], ['Lamp']], + ["Palace of Darkness - Dark Basement - Left", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'Lamp', 'PegasusBoots']], + ["Palace of Darkness - Dark Basement - Left", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'Lamp', 'MoonPearl', 'PegasusBoots']], + ["Palace of Darkness - Dark Basement - Left", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'Lamp', 'MoonPearl', 'ProgressiveGlove', 'ProgressiveGlove']], + ["Palace of Darkness - Dark Basement - Left", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'Lamp', 'MoonPearl', 'TitansMitt']], + + ["Palace of Darkness - Dark Basement - Right", false, []], + ["Palace of Darkness - Dark Basement - Right", false, [], ['Lamp']], + ["Palace of Darkness - Dark Basement - Right", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'Lamp', 'PegasusBoots']], + ["Palace of Darkness - Dark Basement - Right", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'Lamp', 'MoonPearl', 'PegasusBoots']], + ["Palace of Darkness - Dark Basement - Right", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'Lamp', 'MoonPearl', 'ProgressiveGlove', 'ProgressiveGlove']], + ["Palace of Darkness - Dark Basement - Right", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'Lamp', 'MoonPearl', 'TitansMitt']], + + ["Palace of Darkness - Map Chest", false, []], + ["Palace of Darkness - Map Chest", false, [], ['AnyBow']], + ["Palace of Darkness - Map Chest", true, ['BowAndArrows', 'PegasusBoots']], + ["Palace of Darkness - Map Chest", true, ['BowAndArrows', 'MoonPearl', 'PegasusBoots']], + ["Palace of Darkness - Map Chest", true, ['BowAndArrows', 'MoonPearl', 'ProgressiveGlove', 'ProgressiveGlove']], + ["Palace of Darkness - Map Chest", true, ['BowAndArrows', 'MoonPearl', 'TitansMitt']], + + ["Palace of Darkness - Dark Maze - Top", false, []], + ["Palace of Darkness - Dark Maze - Top", false, [], ['Lamp']], + ["Palace of Darkness - Dark Maze - Top", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'Lamp', 'PegasusBoots']], + ["Palace of Darkness - Dark Maze - Top", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'MoonPearl', 'Lamp', 'PegasusBoots']], + ["Palace of Darkness - Dark Maze - Top", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'MoonPearl', 'Lamp', 'ProgressiveGlove', 'ProgressiveGlove']], + ["Palace of Darkness - Dark Maze - Top", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'MoonPearl', 'Lamp', 'TitansMitt']], + + ["Palace of Darkness - Dark Maze - Bottom", false, []], + ["Palace of Darkness - Dark Maze - Bottom", false, [], ['Lamp']], + ["Palace of Darkness - Dark Maze - Bottom", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'Lamp', 'PegasusBoots']], + ["Palace of Darkness - Dark Maze - Bottom", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'MoonPearl', 'Lamp', 'PegasusBoots']], + ["Palace of Darkness - Dark Maze - Bottom", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'MoonPearl', 'Lamp', 'ProgressiveGlove', 'ProgressiveGlove']], + ["Palace of Darkness - Dark Maze - Bottom", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'MoonPearl', 'Lamp', 'TitansMitt']], + + ["Palace of Darkness - Shooter Room", false, []], + ["Palace of Darkness - Shooter Room", true, ['PegasusBoots']], + ["Palace of Darkness - Shooter Room", true, ['MoonPearl', 'ProgressiveGlove', 'ProgressiveGlove']], + ["Palace of Darkness - Shooter Room", true, ['MoonPearl', 'TitansMitt']], + + ["Palace of Darkness - Boss", false, []], + ["Palace of Darkness - Boss", false, [], ['Lamp']], + ["Palace of Darkness - Boss", false, [], ['Hammer']], + ["Palace of Darkness - Boss", false, [], ['AnyBow']], + ["Palace of Darkness - Boss", false, [], ['BigKeyD1']], + ["Palace of Darkness - Boss", true, ['KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'KeyD1', 'BigKeyD1', 'Lamp', 'Hammer', 'BowAndArrows', 'PegasusBoots']], + ]; + } +} \ No newline at end of file diff --git a/tests/HybridMajorGlitches/SkullWoodsTest.php b/tests/HybridMajorGlitches/SkullWoodsTest.php new file mode 100644 index 000000000..4321ac730 --- /dev/null +++ b/tests/HybridMajorGlitches/SkullWoodsTest.php @@ -0,0 +1,139 @@ +world = World::factory('standard', ['difficulty' => 'test_rules', 'logic' => 'HybridMajorGlitches']); + $this->addCollected(['RescueZelda']); + $this->collected->setChecksForWorld($this->world->id); + } + + public function tearDown(): void { + parent::tearDown(); + unset($this->world); + } + + /** + * @param string $location + * @param bool $access + * @param array $items + * @param array $except + * + * @dataProvider accessPool + */ + public function testLocation(string $location, bool $access, array $items, array $except = []) { + if (count($except)) { + $this->collected = $this->allItemsExcept($except); + } + + $this->addCollected($items); + + $this->assertEquals($access, $this->world->getLocation($location) + ->canAccess($this->collected)); + } + + /** + * @param string $location + * @param bool $access + * @param string $item + * @param array $items + * @param array $except + * @param array $keys + * @param string $big_key + * + * @dataProvider fillPool + */ + public function testFillLocation(string $location, bool $access, string $item, array $items = [], array $except = []) { + if (count($except)) { + $this->collected = $this->allItemsExcept($except); + } + + $this->addCollected($items); + + $this->assertEquals($access, $this->world->getLocation($location) + ->fill(Item::get($item, $this->world), $this->collected)); + } + + public function fillPool() { + return [ + ["Skull Woods - Big Chest", true, 'BigKeyD3', [], ['BigKeyD3']], + + ["Skull Woods - Big Key Chest", true, 'BigKeyD3', [], ['BigKeyD3']], + + ["Skull Woods - Compass Chest", true, 'BigKeyD3', [], ['BigKeyD3']], + + ["Skull Woods - Map Chest", true, 'BigKeyD3', [], ['BigKeyD3']], + + ["Skull Woods - Bridge Room", true, 'BigKeyD3', [], ['BigKeyD3']], + + ["Skull Woods - Pot Prison", true, 'BigKeyD3', [], ['BigKeyD3']], + + ["Skull Woods - Pinball Room", true, 'KeyD3', [], ['KeyD3']], + + ["Skull Woods - Boss", true, 'BigKeyD3', [], ['BigKeyD3']], + ["Skull Woods - Boss", true, 'Moon Pearl', [], ['Moon Pearl']], + ["Skull Woods - Boss", false, 'KeyD3', [], ['KeyD3']], + ]; + } + + public function accessPool() { + return [ + ["Skull Woods - Big Chest", false, []], + ["Skull Woods - Big Chest", false, [], ['BigKeyD3']], + ["Skull Woods - Big Chest", true, ['MagicMirror', 'PegasusBoots', 'BigKeyD3']], + ["Skull Woods - Big Chest", true, ['MoonPearl', 'PegasusBoots', 'BigKeyD3']], + + ["Skull Woods - Big Key Chest", false, []], + ["Skull Woods - Big Key Chest", true, ['MagicMirror', 'PegasusBoots']], + ["Skull Woods - Big Key Chest", true, ['MoonPearl', 'PegasusBoots']], + + ["Skull Woods - Compass Chest", false, []], + ["Skull Woods - Compass Chest", true, ['MagicMirror', 'PegasusBoots']], + ["Skull Woods - Compass Chest", true, ['MoonPearl', 'PegasusBoots']], + + ["Skull Woods - Map Chest", false, []], + ["Skull Woods - Map Chest", true, ['MagicMirror', 'PegasusBoots']], + ["Skull Woods - Map Chest", true, ['MoonPearl', 'PegasusBoots']], + + ["Skull Woods - Bridge Room", false, []], + ["Skull Woods - Bridge Room", false, [], ['MoonPearl', 'MagicMirror']], + ["Skull Woods - Bridge Room", false, [], ['MoonPearl', 'PegasusBoots']], + ["Skull Woods - Bridge Room", false, [], ['FireRod']], + ["Skull Woods - Bridge Room", true, ['MoonPearl', 'PegasusBoots', 'FireRod']], + ["Skull Woods - Bridge Room", true, ['MagicMirror', 'PegasusBoots', 'FireRod']], + + ["Skull Woods - Pot Prison", false, []], + ["Skull Woods - Pot Prison", true, ['MagicMirror', 'PegasusBoots']], + ["Skull Woods - Pot Prison", true, ['MoonPearl', 'PegasusBoots']], + + ["Skull Woods - Pinball Room", false, []], + ["Skull Woods - Pinball Room", true, ['MagicMirror', 'PegasusBoots']], + ["Skull Woods - Pinball Room", true, ['MoonPearl', 'PegasusBoots']], + + ["Skull Woods - Boss", false, []], + ["Skull Woods - Boss", false, [], ['MoonPearl', 'MagicMirror']], + ["Skull Woods - Boss", false, [], ['FireRod']], + ["Skull Woods - Boss", false, [], ['AnySword']], + ["Skull Woods - Boss", true, ['KeyD3', 'KeyD3', 'KeyD3', 'PegasusBoots', 'FireRod', 'UncleSword', 'MagicMirror']], + ["Skull Woods - Boss", true, ['KeyD3', 'KeyD3', 'KeyD3', 'MoonPearl', 'PegasusBoots', 'FireRod', 'UncleSword']], + ["Skull Woods - Boss", true, ['KeyD3', 'KeyD3', 'KeyD3', 'MoonPearl', 'PegasusBoots', 'FireRod', 'MasterSword']], + ["Skull Woods - Boss", true, ['KeyD3', 'KeyD3', 'KeyD3', 'MoonPearl', 'PegasusBoots', 'FireRod', 'L3Sword']], + ["Skull Woods - Boss", true, ['KeyD3', 'KeyD3', 'KeyD3', 'MoonPearl', 'PegasusBoots', 'FireRod', 'L4Sword']], + ["Skull Woods - Boss", true, ['KeyD3', 'KeyD3', 'KeyD3', 'MoonPearl', 'PegasusBoots', 'FireRod', 'ProgressiveSword']], + ["Skull Woods - Boss", true, ['KeyD3', 'KeyD3', 'KeyD3', 'MagicMirror', 'PegasusBoots', 'FireRod', 'UncleSword']], + ["Skull Woods - Boss", true, ['KeyD3', 'KeyD3', 'KeyD3', 'MagicMirror', 'PegasusBoots', 'FireRod', 'MasterSword']], + ["Skull Woods - Boss", true, ['KeyD3', 'KeyD3', 'KeyD3', 'MagicMirror', 'PegasusBoots', 'FireRod', 'L3Sword']], + ["Skull Woods - Boss", true, ['KeyD3', 'KeyD3', 'KeyD3', 'MagicMirror', 'PegasusBoots', 'FireRod', 'L4Sword']], + ["Skull Woods - Boss", true, ['KeyD3', 'KeyD3', 'KeyD3', 'MagicMirror', 'PegasusBoots', 'FireRod', 'ProgressiveSword']], + ]; + } +} \ No newline at end of file diff --git a/tests/HybridMajorGlitches/SwampPalaceTest.php b/tests/HybridMajorGlitches/SwampPalaceTest.php new file mode 100644 index 000000000..f4d2c1f3a --- /dev/null +++ b/tests/HybridMajorGlitches/SwampPalaceTest.php @@ -0,0 +1,170 @@ +world = World::factory('standard', ['difficulty' => 'test_rules', 'logic' => 'HybridMajorGlitches']); + $this->addCollected(['RescueZelda']); + $this->world->getLocation("Misery Mire Medallion")->setItem(Item::get('Ether', $this->world)); + $this->collected->setChecksForWorld($this->world->id); + } + + public function tearDown(): void { + parent::tearDown(); + unset($this->world); + } + + /** + * @param string $location + * @param bool $access + * @param array $items + * @param array $except + * + * @dataProvider accessPool + */ + public function testLocation(string $location, bool $access, array $items, array $except = []) { + if (count($except)) { + $this->collected = $this->allItemsExcept($except); + } + + $this->addCollected($items); + + $this->assertEquals($access, $this->world->getLocation($location) + ->canAccess($this->collected)); + } + + /** + * @param string $location + * @param bool $access + * @param string $item + * @param array $items + * @param array $except + * + * @dataProvider fillPool + */ + public function testFillLocation(string $location, bool $access, string $item, array $items = [], array $except = []) { + if (count($except)) { + $this->collected = $this->allItemsExcept($except); + } + + $this->addCollected($items); + + $this->assertEquals($access, $this->world->getLocation($location) + ->fill(Item::get($item, $this->world), $this->collected)); + } + + /** + * @param bool $access + * @param array $items + * @param array $except + * + * @dataProvider entryPool + */ + public function testEntry(bool $access, array $items, array $except = []) { + if (count($except)) { + $this->collected = $this->allItemsExcept($except); + } + + $this->addCollected($items); + + $this->assertEquals($access, $this->world->getRegion('Swamp Palace') + ->canEnter($this->world->getLocations(), $this->collected)); + } + + public function entryPool() { + return [ + [false, []], + [false, ['PegasusBoots', 'Lamp', 'Flippers', 'MoonPearl', 'UncleSword', 'Ether', 'BigKeyP3']], + [true, [], ['MagicMirror']], + [true, ['PegasusBoots', 'MagicMirror', 'Flippers', 'MoonPearl']], + [true, ['PegasusBoots', 'Lamp', 'Flippers', 'MoonPearl', 'UncleSword', 'Ether', 'KeyD6', 'KeyD6', 'KeyD6', 'BigKeyD6']], + ]; + } + + public function fillPool() { + return [ + ["Swamp Palace - Entrance", true, 'BigKeyD2', [], ['BigKeyD2']], + ["Swamp Palace - Entrance", true, 'KeyD2', [], ['KeyD2']], + ["Swamp Palace - Entrance", true, 'Ether', [], ['Ether']], + ["Swamp Palace - Big Chest", true, 'BigKeyD2', [], ['BigKeyD2']], + ["Swamp Palace - Big Key Chest", true, 'BigKeyD2', [], ['BigKeyD2']], + ["Swamp Palace - Map Chest", true, 'BigKeyD2', [], ['BigKeyD2']], + ["Swamp Palace - West Chest", true, 'BigKeyD2', [], ['BigKeyD2']], + ["Swamp Palace - Compass Chest", true, 'BigKeyD2', [], ['BigKeyD2']], + ["Swamp Palace - Flooded Room - Left", true, 'BigKeyD2', [], ['BigKeyD2']], + ["Swamp Palace - Flooded Room - Right", true, 'BigKeyD2', [], ['BigKeyD2']], + ["Swamp Palace - Waterfall Room", true, 'BigKeyD2', [], ['BigKeyD2']], + ["Swamp Palace - Boss", true, 'BigKeyD2', [], ['BigKeyD2']], + ]; + } + + public function accessPool() { + return [ + ["Swamp Palace - Entrance", false, []], + ["Swamp Palace - Entrance", false, [], ['MoonPearl']], + ["Swamp Palace - Entrance", false, [], ['Flippers']], + ["Swamp Palace - Entrance", true, ['MagicMirror', 'MoonPearl', 'Flippers', 'PegasusBoots']], + + ["Swamp Palace - Big Chest", false, []], + ["Swamp Palace - Big Chest", false, [], ['MoonPearl']], + ["Swamp Palace - Big Chest", false, [], ['Flippers']], + ["Swamp Palace - Big Chest", false, ['BigKeyD2', 'MagicMirror', 'MoonPearl', 'Flippers', 'PegasusBoots', 'KeyD6', 'KeyD6', 'Ether', 'UncleSword']], + ["Swamp Palace - Big Chest", true, ['BigKeyD2', 'KeyD2', 'MagicMirror', 'MoonPearl', 'Flippers', 'PegasusBoots', 'Hammer']], + ["Swamp Palace - Big Chest", true, ['BigKeyD2', 'MagicMirror', 'MoonPearl', 'Flippers', 'PegasusBoots', 'KeyD6', 'KeyD6', 'KeyD6', 'Ether', 'UncleSword']], + ["Swamp Palace - Big Chest", true, ['BigKeyD6', 'MagicMirror', 'MoonPearl', 'Flippers', 'PegasusBoots', 'KeyD6', 'KeyD6', 'KeyD6', 'Ether', 'UncleSword']], + + ["Swamp Palace - Big Key Chest", false, []], + ["Swamp Palace - Big Key Chest", false, [], ['MoonPearl']], + ["Swamp Palace - Big Key Chest", false, [], ['Flippers']], + ["Swamp Palace - Big Key Chest", true, ['KeyD2', 'MagicMirror', 'MoonPearl', 'Flippers', 'PegasusBoots', 'Hammer']], + + ["Swamp Palace - Map Chest", false, []], + ["Swamp Palace - Map Chest", false, [], ['MoonPearl']], + ["Swamp Palace - Map Chest", false, [], ['Flippers']], + ["Swamp Palace - Map Chest", true, ['KeyD2', 'MagicMirror', 'MoonPearl', 'Flippers', 'PegasusBoots']], + + ["Swamp Palace - West Chest", false, []], + ["Swamp Palace - West Chest", false, [], ['MoonPearl']], + ["Swamp Palace - West Chest", false, [], ['Flippers']], + ["Swamp Palace - West Chest", true, ['KeyD2', 'MagicMirror', 'MoonPearl', 'Flippers', 'PegasusBoots', 'Hammer']], + + ["Swamp Palace - Compass Chest", false, []], + ["Swamp Palace - Compass Chest", false, [], ['MoonPearl']], + ["Swamp Palace - Compass Chest", false, [], ['Flippers']], + ["Swamp Palace - Compass Chest", true, ['KeyD2', 'MagicMirror', 'MoonPearl', 'Flippers', 'PegasusBoots', 'Hammer']], + + ["Swamp Palace - Flooded Room - Left", false, []], + ["Swamp Palace - Flooded Room - Left", false, [], ['MoonPearl']], + ["Swamp Palace - Flooded Room - Left", false, [], ['Flippers']], + ["Swamp Palace - Flooded Room - Left", false, [], ['Hookshot']], + ["Swamp Palace - Flooded Room - Left", true, ['KeyD2', 'MagicMirror', 'MoonPearl', 'Flippers', 'PegasusBoots', 'Hammer', 'Hookshot']], + + ["Swamp Palace - Flooded Room - Right", false, []], + ["Swamp Palace - Flooded Room - Right", false, [], ['MoonPearl']], + ["Swamp Palace - Flooded Room - Right", false, [], ['Flippers']], + ["Swamp Palace - Flooded Room - Right", false, [], ['Hookshot']], + ["Swamp Palace - Flooded Room - Right", true, ['KeyD2', 'MagicMirror', 'MoonPearl', 'Flippers', 'PegasusBoots', 'Hammer', 'Hookshot']], + + ["Swamp Palace - Waterfall Room", false, []], + ["Swamp Palace - Waterfall Room", false, [], ['MoonPearl']], + ["Swamp Palace - Waterfall Room", false, [], ['Flippers']], + ["Swamp Palace - Waterfall Room", false, [], ['Hookshot']], + ["Swamp Palace - Waterfall Room", true, ['KeyD2', 'MagicMirror', 'MoonPearl', 'Flippers', 'PegasusBoots', 'Hammer', 'Hookshot']], + + ["Swamp Palace - Boss", false, []], + ["Swamp Palace - Boss", false, [], ['MoonPearl']], + ["Swamp Palace - Boss", false, [], ['Flippers']], + ["Swamp Palace - Boss", false, [], ['Hookshot']], + ["Swamp Palace - Boss", true, ['KeyD2', 'MagicMirror', 'MoonPearl', 'Flippers', 'PegasusBoots', 'Hammer', 'Hookshot']], + ]; + } +} \ No newline at end of file diff --git a/tests/HybridMajorGlitches/TowerOfHeraTest.php b/tests/HybridMajorGlitches/TowerOfHeraTest.php new file mode 100644 index 000000000..aae824d8e --- /dev/null +++ b/tests/HybridMajorGlitches/TowerOfHeraTest.php @@ -0,0 +1,134 @@ +world = World::factory('standard', ['difficulty' => 'test_rules', 'logic' => 'HybridMajorGlitches']); + $this->addCollected(['RescueZelda']); + $this->world->getLocation("Misery Mire Medallion")->setItem(Item::get('Ether', $this->world)); + $this->collected->setChecksForWorld($this->world->id); + } + + public function tearDown(): void { + parent::tearDown(); + unset($this->world); + } + + /** + * @param bool $access + * @param array $items + * @param array $except + * + * @dataProvider entryPool + */ + public function testEntry(bool $access, array $items, array $except = []) { + if (count($except)) { + $this->collected = $this->allItemsExcept($except); + } + + $this->addCollected($items); + + $this->assertEquals($access, $this->world->getRegion('Tower of Hera') + ->canEnter($this->world->getLocations(), $this->collected)); + } + + public function entryPool() { + return [ + [false, []], + [true, ['PegasusBoots']], + ]; + } + + /** + * @param string $location + * @param bool $access + * @param array $items + * @param array $except + * + * @dataProvider accessPool + */ + public function testLocation(string $location, bool $access, array $items, array $except = []) { + if (count($except)) { + $this->collected = $this->allItemsExcept($except); + } + + $this->addCollected($items); + + $this->assertEquals($access, $this->world->getLocation($location) + ->canAccess($this->collected)); + } + + /** + * @param string $location + * @param bool $access + * @param string $item + * @param array $items + * @param array $except + * @param array $keys + * @param string $big_key + * + * @dataProvider fillPool + */ + public function testFillLocation(string $location, bool $access, string $item, array $items = [], array $except = []) { + if (count($except)) { + $this->collected = $this->allItemsExcept($except); + } + + $this->addCollected($items); + + $this->assertEquals($access, $this->world->getLocation($location) + ->fill(Item::get($item, $this->world), $this->collected)); + } + + + public function fillPool() { + return [ + ["Tower of Hera - Big Key Chest", true, 'BigKeyP3', [], ['BigKeyP3']], + ["Tower of Hera - Big Key Chest", true, 'KeyP3', [], ['KeyP3']], + ["Tower of Hera - Basement Cage", true, 'BigKeyP3', [], ['BigKeyP3']], + ["Tower of Hera - Map Chest", true, 'BigKeyP3', [], ['BigKeyP3']], + ["Tower of Hera - Compass Chest", true, 'BigKeyP3', [], ['BigKeyP3']], + ["Tower of Hera - Big Chest", true, 'BigKeyP3', [], ['BigKeyP3']], + ["Tower of Hera - Boss", true, 'BigKeyP3', [], ['BigKeyP3']], + ]; + } + + public function accessPool() { + return [ + ["Tower of Hera - Big Key Chest", false, []], + ["Tower of Hera - Big Key Chest", false, [], ['KeyP3']], + ["Tower of Hera - Big Key Chest", true, ['Lamp', 'PegasusBoots', 'KeyP3']], + + ["Tower of Hera - Basement Cage", false, []], + ["Tower of Hera - Basement Cage", true, ['PegasusBoots']], + + ["Tower of Hera - Map Chest", false, []], + ["Tower of Hera - Map Chest", true, ['PegasusBoots']], + + ["Tower of Hera - Compass Chest", false, []], + ["Tower of Hera - Compass Chest", true, ['PegasusBoots', 'BigKeyP3']], + ["Tower of Hera - Compass Chest", true, ['PegasusBoots', 'BigKeyD6', 'Ether', 'UncleSword', 'MoonPearl']], + + ["Tower of Hera - Big Chest", false, []], + ["Tower of Hera - Big Chest", true, ['PegasusBoots', 'BigKeyP3']], + + ["Tower of Hera - Boss", false, []], + ["Tower of Hera - Boss", false, [], ['AnySword', 'Hammer']], + ["Tower of Hera - Boss", true, ['PegasusBoots', 'BigKeyP3', 'ProgressiveSword']], + ["Tower of Hera - Boss", true, ['PegasusBoots', 'BigKeyP3', 'UncleSword']], + ["Tower of Hera - Boss", true, ['PegasusBoots', 'BigKeyP3', 'MasterSword']], + ["Tower of Hera - Boss", true, ['PegasusBoots', 'BigKeyP3', 'L3Sword']], + ["Tower of Hera - Boss", true, ['PegasusBoots', 'BigKeyP3', 'L4Sword']], + ["Tower of Hera - Boss", true, ['PegasusBoots', 'BigKeyP3', 'Hammer']], + ]; + } +} \ No newline at end of file