Skip to content

Commit

Permalink
Merge pull request #1059 from sporchia/v31.2.0
Browse files Browse the repository at this point in the history
V31.2.0
  • Loading branch information
sporchia authored Aug 31, 2023
2 parents c602322 + b4bb57e commit bab21e5
Show file tree
Hide file tree
Showing 66 changed files with 3,581 additions and 2,604 deletions.
2 changes: 1 addition & 1 deletion app/Console/Commands/Sprites.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function handle()
return 102;
}

$sprite_sheet = 'sprites.31.1.png';
$sprite_sheet = 'sprites.31.2.png';

$this->sprToPng($sprite_dir);

Expand Down
12 changes: 11 additions & 1 deletion app/EntranceRandomizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class EntranceRandomizer implements RandomizerContract
'dungeons' => 'dungeons',
'pedestal' => 'pedestal',
'triforce-hunt' => 'triforcehunt',
'ganonhunt' => 'ganonhunt',
'completionist' => 'completionist',
];
/** @var array */
private $swords_lookup = [
Expand Down Expand Up @@ -100,9 +102,17 @@ public function randomize(): void
$flags[] = '--hint';
}

if ($this->world->config('rom.hudItemCounter') === true) {
$flags[] = '--huditemcounter';
}

if ($this->world->config('fastrom', true) === false) {
$flags[] = '--nofastrom';
}

$proc = new Process(array_merge(
[
'python3.9',
'python3.10',
base_path('vendor/z3/entrancerandomizer/EntranceRandomizer.py'),
'--mode',
$mode,
Expand Down
21 changes: 0 additions & 21 deletions app/Helpers/str.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
<?php

/**
* mb_str_pad
*
* @param string $input
* @param int $pad_length
* @param string $pad_string
* @param int $pad_type
* @param string $encoding
*
* @return string
*/
function mb_str_pad($input, $pad_length, $pad_string = ' ', $pad_type = STR_PAD_RIGHT, $encoding = null)
{
if (!$encoding) {
$diff = strlen($input) - mb_strlen($input);
} else {
$diff = strlen($input) - mb_strlen($input, $encoding);
}
return str_pad($input, $pad_length + $diff, $pad_string, $pad_type);
}

/**
* mb_wordwrap
*
Expand Down
21 changes: 11 additions & 10 deletions app/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public static function all(World $world)
new Item('BookOfMudora', [0x1D], $world),
new Item('Flippers', [0x1E], $world),
new Item('MoonPearl', [0x1F], $world),
new Item\Crystal('Crystal', [0x20], $world),
new Item('BugCatchingNet', [0x21], $world),
new Item\Armor('BlueMail', [0x22], $world),
new Item\Armor('RedMail', [0x23], $world),
Expand All @@ -144,9 +145,9 @@ public static function all(World $world)
new Item('OneRupee', [0x34], $world),
new Item('FiveRupees', [0x35], $world),
new Item('TwentyRupees', [0x36], $world),
new Item\Pendant('PendantOfCourage', [0x37, 0x04, 0x38, 0x62, 0x00, 0x69, 0x01], $world),
new Item\Pendant('PendantOfWisdom', [0x38, 0x01, 0x32, 0x60, 0x00, 0x69, 0x03], $world),
new Item\Pendant('PendantOfPower', [0x39, 0x02, 0x34, 0x60, 0x00, 0x69, 0x02], $world),
new Item\Pendant('PendantOfCourage', [0x37, 0x04, 0x38, 0x62, 0x00, 0x69, 0x37], $world),
new Item\Pendant('PendantOfWisdom', [0x38, 0x01, 0x32, 0x60, 0x00, 0x69, 0x38], $world),
new Item\Pendant('PendantOfPower', [0x39, 0x02, 0x34, 0x60, 0x00, 0x69, 0x39], $world),
new Item\Bow('BowAndArrows', [0x3A], $world),
new Item\Bow('BowAndSilverArrows', [0x3B], $world),
new Item\Bottle('BottleWithBee', [0x3C], $world),
Expand Down Expand Up @@ -250,13 +251,13 @@ public static function all(World $world)
new Item\Key('KeyD7', [0xAC], $world),
new Item\Key('KeyA2', [0xAD], $world),
new Item\Key('KeyGK', [0xAF], $world),
new Item\Crystal('Crystal1', [null, 0x02, 0x34, 0x64, 0x40, 0x7F, 0x06], $world),
new Item\Crystal('Crystal2', [null, 0x10, 0x34, 0x64, 0x40, 0x79, 0x06], $world),
new Item\Crystal('Crystal3', [null, 0x40, 0x34, 0x64, 0x40, 0x6C, 0x06], $world),
new Item\Crystal('Crystal4', [null, 0x20, 0x34, 0x64, 0x40, 0x6D, 0x06], $world),
new Item\Crystal('Crystal5', [null, 0x04, 0x32, 0x64, 0x40, 0x6E, 0x06], $world),
new Item\Crystal('Crystal6', [null, 0x01, 0x32, 0x64, 0x40, 0x6F, 0x06], $world),
new Item\Crystal('Crystal7', [null, 0x08, 0x34, 0x64, 0x40, 0x7C, 0x06], $world),
new Item\Crystal('Crystal1', [null, 0x02, 0x34, 0x64, 0x40, 0x7F, 0x20], $world),
new Item\Crystal('Crystal2', [null, 0x10, 0x34, 0x64, 0x40, 0x79, 0x20], $world),
new Item\Crystal('Crystal3', [null, 0x40, 0x34, 0x64, 0x40, 0x6C, 0x20], $world),
new Item\Crystal('Crystal4', [null, 0x20, 0x34, 0x64, 0x40, 0x6D, 0x20], $world),
new Item\Crystal('Crystal5', [null, 0x04, 0x32, 0x64, 0x40, 0x6E, 0x20], $world),
new Item\Crystal('Crystal6', [null, 0x01, 0x32, 0x64, 0x40, 0x6F, 0x20], $world),
new Item\Crystal('Crystal7', [null, 0x08, 0x34, 0x64, 0x40, 0x7C, 0x20], $world),
new Item\Event('RescueZelda', [null], $world),
new Item\Event('DefeatAgahnim', [null], $world),
new Item\Event('BigRedBomb', [null], $world),
Expand Down
27 changes: 17 additions & 10 deletions app/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,22 +240,29 @@ public function writeItem(Rom $rom, Item $item = null)

$item = $this->item;

if ($item instanceof Item\Key && $this->region->isRegionItem($item)
&& (!in_array($this->name, ["Secret Passage", "Link's Uncle"]) || $item != Item::get('KeyH2', $this->region->getWorld()))) { // special key-sanity case
$item = Item::get('Key', $this->region->getWorld());
if ($this->region->getWorld()->config('rom.vanillaKeys', false)
&& $item instanceof Item\Key && $this->region->isRegionItem($item)
&& (!in_array($this->name, ["Secret Passage", "Link's Uncle"]) || $item != Item::get('KeyH2', $this->region->getWorld()))) {
$item = Item::get('Key', $this->region->getWorld());
}

if ($item instanceof Item\BigKey && $this->region->isRegionItem($item)) {
$item = Item::get('BigKey', $this->region->getWorld());
if ($this->region->getWorld()->config('rom.vanillaBigKeys', false)
&& $item instanceof Item\BigKey
&& $this->region->isRegionItem($item)) {
$item = Item::get('BigKey', $this->region->getWorld());
}

if ($item instanceof Item\Map && $this->region->isRegionItem($item)
&& (!in_array($this->name, ["Secret Passage", "Link's Uncle"]) || $item != Item::get('MapH2', $this->region->getWorld()))) { // special key-sanity case
$item = Item::get('Map', $this->region->getWorld());
if ($this->region->getWorld()->config('rom.vanillaMaps', false)
&& $item instanceof Item\Map
&& $this->region->isRegionItem($item)
&& (!in_array($this->name, ["Secret Passage", "Link's Uncle"]) || $item != Item::get('MapH2', $this->region->getWorld()))) {
$item = Item::get('Map', $this->region->getWorld());
}

if ($item instanceof Item\Compass && $this->region->isRegionItem($item)) {
$item = Item::get('Compass', $this->region->getWorld());
if ($this->region->getWorld()->config('rom.vanillaCompasses', false)
&& $item instanceof Item\Compass
&& $this->region->isRegionItem($item)) {
$item = Item::get('Compass', $this->region->getWorld());
}

if ($this->region->getWorld()->config('rom.genericKeys', false) && $item instanceof Item\Key) {
Expand Down
9 changes: 9 additions & 0 deletions app/Randomizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ public function randomize(): void
*/
public function prepareWorld(World $world): void
{
if ($world->config('goal') == 'completionist' && $world->config('accessibility') != 'locations') {
throw new \Exception("The Completionist goal requires 100% locations accessibility");
}

switch ($world->config('goal')) {
case 'pedestal':
$world->getLocation("Master Sword Pedestal")->setItem(Item::get('Triforce', $world));
Expand All @@ -104,6 +108,7 @@ public function prepareWorld(World $world): void
case 'fast_ganon':
case 'dungeons':
case 'ganonhunt':
case 'completionist':
$world->getLocation("Ganon")->setItem(Item::get('Triforce', $world));
break;
}
Expand Down Expand Up @@ -1026,7 +1031,11 @@ public function setTexts(World $world)
break;
case 'dungeons':
$world->setText('sign_ganon', "You need to defeat all of Ganon's bosses.");
$world->setText('ganon_fall_in_alt', "You think you\nare ready to\nface me?\n\nI will not die\n\nunless you\ncomplete your\ngoals. Dingus!");

break;
case 'completionist':
$world->setText('sign_ganon', "You need to collect EVERY item and defeat EVERY boss.");
// no-break
default:
$world->setText('ganon_fall_in_alt', "You think you\nare ready to\nface me?\n\nI will not die\n\nunless you\ncomplete your\ngoals. Dingus!");
Expand Down
2 changes: 2 additions & 0 deletions app/Region/Inverted/SwampPalace.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public function initalize()
|| ($hera($locations, $items) && $items->has('BigKeyP3')));
})->setAlwaysAllow(function ($item, $items) {
return $this->world->config('accessibility') !== 'locations' && $item == Item::get('BigKeyD2', $this->world);
})->setFillRules(function ($item, $locations, $items) {
return $this->world->config('accessibility') !== 'locations' || $item != Item::get('BigKeyD2', $this->world);
});

$this->locations["Swamp Palace - Big Key Chest"]->setRequirements(function ($locations, $items) use ($mire, $hera) {
Expand Down
2 changes: 2 additions & 0 deletions app/Region/Inverted/TowerOfHera.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public function initalize()
&& $items->canBunnyRevive($this->world)))) || $mire($locations, $items));
})->setAlwaysAllow(function ($item, $items) {
return $this->world->config('accessibility') !== 'locations' && $item == Item::get('KeyP3', $this->world);
})->setFillRules(function ($item, $locations, $items) {
return $this->world->config('accessibility') !== 'locations' || $item != Item::get('KeyP3', $this->world);
});

$this->locations["Tower of Hera - Compass Chest"]->setRequirements(function ($locations, $items) use ($main, $mire) {
Expand Down
2 changes: 2 additions & 0 deletions app/Region/Inverted/TurtleRock.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ public function initalize()
|| $this->locations["Turtle Rock - Big Key Chest"]->hasItem(Item::get('KeyD7', $this->world)));
})->setAlwaysAllow(function ($item, $items) {
return $item == Item::get('KeyD7', $this->world);
})->setFillRules(function ($item, $locations, $items) {
return $this->world->config('accessibility') !== 'locations' || $item != Item::get('KeyD7', $this->world);
});

$this->locations["Turtle Rock - Crystaroller Room"]->setRequirements(function ($locations, $items) {
Expand Down
5 changes: 3 additions & 2 deletions app/Region/Standard/DarkWorld/NorthEast.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,9 @@ public function initalize()
|| $this->world->config('canMirrorClip', false))
&& $this->world->getRegion('West Death Mountain')->canEnter($locations, $items))
|| ($items->has('Hammer') && $items->canLiftRocks() && $items->has('MoonPearl'))
|| (($items->canLiftDarkRocks() || ($this->world->config('canSuperSpeed', false) && $items->canSpinSpeed())
|| ($items->has('MagicMirror') && $this->world->config('canMirrorClip', false)))
|| (($items->canLiftDarkRocks() || ($this->world->getRegion('West Death Mountain')->canEnter($locations, $items)
&& ($this->world->config('canSuperSpeed', false) && $items->canSpinSpeed()
|| ($items->has('MagicMirror') && $this->world->config('canMirrorClip', false)))))
&& $items->has('MoonPearl')
&& ($items->has('Hammer') || $items->has('Flippers')
|| ($items->has('MagicMirror') && $this->world->config('canMirrorWrap', false) && $items->canLiftRocks())
Expand Down
4 changes: 3 additions & 1 deletion app/Region/Standard/DesertPalace.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class DesertPalace extends Region
'KeyP2',
'Map',
'MapP2',
'MapP2',
'PendantOfPower'
];

/**
Expand All @@ -57,7 +59,7 @@ public function __construct(World $world)
new Location\Chest("Desert Palace - Compass Chest", [0xE9CB], null, $this),
new Location\Drop("Desert Palace - Boss", [0x180151], null, $this),

new Location\Prize\Pendant("Desert Palace - Prize", [null, 0x1209E, 0x53F1C, 0x53F1D, 0x180053, 0x180078, 0xC6FF], null, $this),
new Location\Prize\Pendant("Desert Palace - Prize", [null, 0x1209E, 0x53E7A, 0x53E7B, 0x180053, 0x180072, 0xC6FF], null, $this),
]);
$this->locations->setChecksForWorld($world->id);
$this->prize_location = $this->locations["Desert Palace - Prize"];
Expand Down
3 changes: 2 additions & 1 deletion app/Region/Standard/EasternPalace.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class EasternPalace extends Region
'KeyP1',
'Map',
'MapP1',
'PendantOfWisdom'
];

/**
Expand All @@ -54,7 +55,7 @@ public function __construct(World $world)
new Location\Chest("Eastern Palace - Map Chest", [0xE9F5], null, $this),
new Location\Drop("Eastern Palace - Boss", [0x180150], null, $this),

new Location\Prize\Pendant("Eastern Palace - Prize", [null, 0x1209D, 0x53EF8, 0x53EF9, 0x180052, 0x18007C, 0xC6FE], null, $this),
new Location\Prize\Pendant("Eastern Palace - Prize", [null, 0x1209D, 0x53E76, 0x53E77, 0x180052, 0x180070, 0xC6FE], null, $this),
]);
$this->locations->setChecksForWorld($world->id);
$this->prize_location = $this->locations["Eastern Palace - Prize"];
Expand Down
3 changes: 2 additions & 1 deletion app/Region/Standard/GanonsTower.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ public function initalize()
$this->locations["Ganon's Tower - Bob's Chest"]->setRequirements(function ($locations, $items) {
return (($items->has('Hammer') && $items->has('Hookshot'))
|| ($items->has('FireRod') && $items->has('CaneOfSomaria')))
&& $items->has('KeyA2', 3);
&& $items->has('KeyA2', 3)
&& ($this->world->config('itemPlacement') != 'basic' || ($items->has('FireRod') || ($items->has('Ether') && $items->hasSword(1))));
});

$this->locations["Ganon's Tower - Tile Room"]->setRequirements(function ($locations, $items) {
Expand Down
18 changes: 8 additions & 10 deletions app/Region/Standard/IcePalace.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class IcePalace extends Region
'KeyD5',
'Map',
'MapD5',
'Crystal5',
];

/**
Expand All @@ -55,7 +56,7 @@ public function __construct(World $world)
new Location\BigChest("Ice Palace - Big Chest", [0xE9AA], null, $this),
new Location\Drop("Ice Palace - Boss", [0x180157], null, $this),

new Location\Prize\Crystal("Ice Palace - Prize", [null, 0x120A4, 0x53F5A, 0x53F5B, 0x180059, 0x180073, 0xC705], null, $this),
new Location\Prize\Crystal("Ice Palace - Prize", [null, 0x120A4, 0x53E86, 0x53E87, 0x180059, 0x180078, 0xC705], null, $this),
]);
$this->locations->setChecksForWorld($world->id);
$this->prize_location = $this->locations["Ice Palace - Prize"];
Expand All @@ -73,26 +74,23 @@ public function initalize()
return $items->has('Hammer') && $items->canLiftRocks()
&& (!$this->world->config('region.cantTakeDamage', false)
|| $items->has('CaneOfByrna') || $items->has('Cape') || $items->has('Hookshot'))
&& ($items->has('Hookshot') || $items->has('ShopKey')
|| ($items->has('KeyD5', 1) && (!$items->has('BigKeyD5') || $locations->itemInLocations(Item::get('BigKeyD5', $this->world),
['Ice Palace - Map Chest','Ice Palace - Spike Room']))));
&& ($this->locations["Ice Palace - Spike Room"]->canAccess($items));
});

$this->locations["Ice Palace - Map Chest"]->setRequirements(function ($locations, $items) {
return $items->has('Hammer') && $items->canLiftRocks()
&& (!$this->world->config('region.cantTakeDamage', false)
|| $items->has('CaneOfByrna') || $items->has('Cape') || $items->has('Hookshot'))
&& ($items->has('Hookshot') || $items->has('ShopKey')
|| ($items->has('KeyD5', 1) && (!$items->has('BigKeyD5') || $locations->itemInLocations(Item::get('BigKeyD5', $this->world),
['Ice Palace - Big Key Chest','Ice Palace - Spike Room']))));
&& ($this->locations["Ice Palace - Spike Room"]->canAccess($items));
});

$this->locations["Ice Palace - Spike Room"]->setRequirements(function ($locations, $items) {
return (!$this->world->config('region.cantTakeDamage', false)
|| $items->has('CaneOfByrna') || $items->has('Cape') || $items->has('Hookshot'))
&& ($items->has('Hookshot') || $items->has('ShopKey')
|| ($items->has('KeyD5', 1) && (!$items->has('BigKeyD5') || $locations->itemInLocations(Item::get('BigKeyD5', $this->world),
['Ice Palace - Big Key Chest','Ice Palace - Map Chest']))));
&& (($items->has('Hookshot') || $items->has('ShopKey'))
|| $items->has('KeyD5', 1)
&& $locations->itemInLocations(Item::get('BigKeyD5', $this->world),
['Ice Palace - Spike Room', 'Ice Palace - Big Key Chest','Ice Palace - Map Chest']));
});

$this->locations["Ice Palace - Freezor Chest"]->setRequirements(function ($locations, $items) {
Expand Down
3 changes: 2 additions & 1 deletion app/Region/Standard/MiseryMire.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class MiseryMire extends Region
'KeyD6',
'Map',
'MapD6',
'Crystal6',
];

/**
Expand All @@ -55,7 +56,7 @@ public function __construct(World $world)
new Location\Chest("Misery Mire - Spike Chest", [0xE9DA], null, $this),
new Location\Drop("Misery Mire - Boss", [0x180158], null, $this),

new Location\Prize\Crystal("Misery Mire - Prize", [null, 0x120A2, 0x53F48, 0x53F49, 0x180057, 0x180075, 0xC703], null, $this),
new Location\Prize\Crystal("Misery Mire - Prize", [null, 0x120A2, 0x53E84, 0x53E85, 0x180057, 0x180077, 0xC703], null, $this),
]);
$this->locations->setChecksForWorld($world->id);
$this->prize_location = $this->locations["Misery Mire - Prize"];
Expand Down
3 changes: 2 additions & 1 deletion app/Region/Standard/PalaceOfDarkness.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class PalaceOfDarkness extends Region
'KeyD1',
'Map',
'MapD1',
'Crystal1'
];

/**
Expand Down Expand Up @@ -61,7 +62,7 @@ public function __construct(World $world)
new Location\Chest("Palace of Darkness - Dark Maze - Bottom", [0xEA58], null, $this),
new Location\Drop("Palace of Darkness - Boss", [0x180153], null, $this),

new Location\Prize\Crystal("Palace of Darkness - Prize", [null, 0x120A1, 0x53F00, 0x53F01, 0x180056, 0x18007D, 0xC702], null, $this),
new Location\Prize\Crystal("Palace of Darkness - Prize", [null, 0x120A1, 0x53E7C, 0x53E7D, 0x180056, 0x180073, 0xC702], null, $this),
]);
$this->locations->setChecksForWorld($world->id);
$this->prize_location = $this->locations["Palace of Darkness - Prize"];
Expand Down
Loading

0 comments on commit bab21e5

Please sign in to comment.