Skip to content

Commit

Permalink
Merge pull request #785 from sporchia/v31.0.4
Browse files Browse the repository at this point in the history
V31.0.4
  • Loading branch information
sporchia authored Feb 10, 2020
2 parents ce0c468 + 97ff061 commit 4499559
Show file tree
Hide file tree
Showing 176 changed files with 16,498 additions and 3,083 deletions.
18 changes: 9 additions & 9 deletions app/Boss.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ public static function all(World $world): BossCollection
static::$worlds[$world->id] = $world;

static::$items[$world->id] = new BossCollection([
new static("Armos Knights", "Armos", function ($locations, $items) {
return $items->hasSword() || $items->has('Hammer') || $items->canShootArrows()
new static("Armos Knights", "Armos", function ($locations, $items) use ($world) {
return $items->hasSword() || $items->has('Hammer') || $items->canShootArrows($world)
|| $items->has('Boomerang') || $items->has('RedBoomerang')
|| ($items->canExtendMagic(4) && ($items->has('FireRod') || $items->has('IceRod')))
|| ($items->canExtendMagic(2) && ($items->has('CaneOfByrna') || $items->has('CaneOfSomaria')));
}),
new static("Lanmolas", "Lanmola", function ($locations, $items) {
new static("Lanmolas", "Lanmola", function ($locations, $items) use ($world) {
return $items->hasSword() || $items->has('Hammer')
|| $items->canShootArrows() || $items->has('FireRod') || $items->has('IceRod')
|| $items->canShootArrows($world) || $items->has('FireRod') || $items->has('IceRod')
|| $items->has('CaneOfByrna') || $items->has('CaneOfSomaria');
}),
new static("Moldorm", "Moldorm", function ($locations, $items) {
Expand All @@ -83,14 +83,14 @@ public static function all(World $world): BossCollection
new static("Agahnim", "Agahnim", function ($locations, $items) {
return $items->hasSword() || $items->has('Hammer') || $items->has('BugCatchingNet');
}),
new static("Helmasaur King", "Helmasaur", function ($locations, $items) {
new static("Helmasaur King", "Helmasaur", function ($locations, $items) use ($world) {
return ($items->canBombThings() || $items->has('Hammer'))
&& ($items->hasSword(2) || $items->canShootArrows());
&& ($items->hasSword(2) || $items->canShootArrows($world));
}),
new static("Arrghus", "Arrghus", function ($locations, $items) use ($world) {
return ($world->config('itemPlacement') !== 'basic' || $world->config('mode.weapons') === 'swordless' || $items->hasSword(2))
&& $items->has('Hookshot') && ($items->has('Hammer') || $items->hasSword()
|| (($items->canExtendMagic(2) || $items->canShootArrows()) && ($items->has('FireRod') || $items->has('IceRod'))));
|| (($items->canExtendMagic(2) || $items->canShootArrows($world)) && ($items->has('FireRod') || $items->has('IceRod'))));
}),
new static("Mothula", "Mothula", function ($locations, $items) use ($world) {
return ($world->config('itemPlacement') !== 'basic' || $items->hasSword(2) || ($items->canExtendMagic(2) && $items->has('FireRod')))
Expand All @@ -112,8 +112,8 @@ public static function all(World $world): BossCollection
|| ($items->canExtendMagic(2) && $items->has('FireRod') && $items->has('Bombos') && $world->config('mode.weapons') === 'swordless'));
}),
new static("Vitreous", "Vitreous", function ($locations, $items) use ($world) {
return ($world->config('itemPlacement') !== 'basic' || $items->hasSword(2) || $items->canShootArrows())
&& ($items->has('Hammer') || $items->hasSword() || $items->canShootArrows());
return ($world->config('itemPlacement') !== 'basic' || $items->hasSword(2) || $items->canShootArrows($world))
&& ($items->has('Hammer') || $items->hasSword() || $items->canShootArrows($world));
}),
new static("Trinexx", "Trinexx", function ($locations, $items) use ($world) {
return $items->has('FireRod') && $items->has('IceRod')
Expand Down
3 changes: 3 additions & 0 deletions app/Filler/RandomAssumed.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ protected function fillItemsInLocations($fill_items, $locations, $base_assumed_i

$found_locations = 0;
$assumed_items = $starting_items->copy();
foreach ($this->worlds as $world) {
$assumed_items = $assumed_items->merge($world->getPreCollectedItems());
}
do {
$current_locations = 0;
foreach ($this->worlds as $world) {
Expand Down
13 changes: 12 additions & 1 deletion app/Http/Controllers/CustomizerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace ALttP\Http\Controllers;

use ALttP\Enemizer;
use ALttP\Item;
use ALttP\Jobs\SendPatchToDisk;
use ALttP\Randomizer;
Expand Down Expand Up @@ -46,11 +47,14 @@ public function generateSeed(Request $request)
case "mystery":
$return_payload['spoiler'] = array_only($return_payload['spoiler'], ['meta']);
$return_payload['spoiler']['meta'] = array_only($return_payload['spoiler']['meta'], [
'name',
'notes',
'logic',
'build',
'tournament',
'spoilers',
'size'
'size',
'special'
]);
break;
case "off":
Expand Down Expand Up @@ -173,6 +177,7 @@ protected function prepSeed(Request $request, bool $save = false)
'enemizer.enemyShuffle' => $request->input('enemizer.enemy_shuffle', 'none'),
'enemizer.enemyDamage' => $request->input('enemizer.enemy_damage', 'default'),
'enemizer.enemyHealth' => $request->input('enemizer.enemy_health', 'default'),
'ignoreCanKillEscapeThings' => array_key_exists(base64_encode("Link's Uncle:1"), $request->input('l')),
'customPrizePacks' => true,
], $custom_data));

Expand Down Expand Up @@ -241,6 +246,12 @@ protected function prepSeed(Request $request, bool $save = false)
'difficulty' => 'custom',
]));

if ($world->isEnemized()) {
$patch = $rom->getWriteLog();
$en = new Enemizer($world, $patch);
$en->randomize();
$en->writeToRom($rom);
}

if ($request->input('tournament', false)) {
$rom->setTournamentType('standard');
Expand Down
5 changes: 4 additions & 1 deletion app/Http/Controllers/RandomizerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ public function generateSeed(CreateRandomizedGame $request)
case "mystery":
$return_payload['spoiler'] = array_only($return_payload['spoiler'], ['meta']);
$return_payload['spoiler']['meta'] = array_only($return_payload['spoiler']['meta'], [
'name',
'notes',
'logic',
'build',
'tournament',
'spoilers',
'size'
'size',
'special'
]);
break;
case "off":
Expand Down
3 changes: 2 additions & 1 deletion app/Jobs/SendPatchToDisk.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public function handle()
'build',
'tournament',
'spoilers',
'size'
'size',
'special'
]);
break;
case "generate":
Expand Down
35 changes: 31 additions & 4 deletions app/Randomizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public function prepareWorld(World $world): void
$world->getLocation($location)->setItem(array_pop($nice_items_swords));
}
if (!$world->getLocation("Master Sword Pedestal")->hasItem(Item::get('Triforce', $world))) {
$world->getLocation($location)->setItem(array_pop($nice_items_swords));
$world->getLocation("Master Sword Pedestal")->setItem(array_pop($nice_items_swords));
} else {
array_pop($nice_items_swords);
array_push($trash_items, Item::get('TwentyRupees', $world));
Expand All @@ -256,10 +256,15 @@ public function prepareWorld(World $world): void
}
}

// put 1 more sword back in
// put master sword back in
if (count($nice_items_swords)) {
array_push($advancement_items, array_pop($nice_items_swords));
}

// put tempered sword back in if logically required
if ($world->config('region.requireBetterSword', false) && count($nice_items_swords)) {
array_push($advancement_items, array_pop($nice_items_swords));
}

if (count($nice_items_swords)) {
if ($world->config('region.takeAnys', false)) {
Expand Down Expand Up @@ -930,13 +935,35 @@ public function setTexts(World $world)
$progressive_bow_locations = $world->getLocationsWithItem(Item::get('ProgressiveBow', $world))->randomCollection(2);
if ($progressive_bow_locations->count() > 0) {
$first_location = $progressive_bow_locations->pop();
$world->setText('ganon_phase_3_no_silvers', "Did you find\nthe arrows in\n" . $first_location->getRegion()->getName());
switch ($first_location->getRegion()->getName()) {
case "Ganons Tower":
$world->setText('ganon_phase_3_no_silvers', "Did you find\nthe arrows in\nMy tower?");
break;
default:
$world->setText('ganon_phase_3_no_silvers', "Did you find\nthe arrows in\n" . $first_location->getRegion()->getName());
}
// Progressive Bow Alternate
$first_location->setItem(new Item\Bow('ProgressiveBow', [0x65], $world));

if ($progressive_bow_locations->count() > 0) {
$second_location = $progressive_bow_locations->pop();
$world->setText('ganon_phase_3_no_silvers_alt', "Did you find\nthe arrows in\n" . $second_location->getRegion()->getName());
switch ($second_location->getRegion()->getName()) {
case "Ganons Tower":
$world->setText('ganon_phase_3_no_silvers_alt', "Did you find\nthe arrows in\nMy tower?");
break;
default:
$world->setText('ganon_phase_3_no_silvers_alt', "Did you find\nthe arrows in\n" . $second_location->getRegion()->getName());
}
}
// Remove Hint in Hard+ Item Pool
if ($world->config('item.overflow.count.Bow') < 2) {
$world->setText('ganon_phase_3_no_silvers', "Did you find\nthe arrows on\nPlanet Zebes?");
$world->setText('ganon_phase_3_no_silvers_alt', "Did you find\nthe arrows on\nPlanet Zebes?");
// Special No Silvers "Hint" for Crowd Control
if ($world->config('item.pool') == 'crowd_control') {
$world->setText('ganon_phase_3_no_silvers', "Chat said no\nto Silvers.\nIt's over Hero");
$world->setText('ganon_phase_3_no_silvers_alt', "Chat said no\nto Silvers.\nIt's over Hero");
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/Region/Inverted/DarkWorld/NorthEast.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function initalize()
});

$this->locations["Pyramid Fairy - Bow"]->setRequirements(function ($locations, $items) {
return $items->canShootArrows()
return $items->canShootArrows($this->world)
&& $items->has('BigRedBomb')
&& $items->has('MagicMirror');
});
Expand Down
11 changes: 6 additions & 5 deletions app/Region/Inverted/DesertPalace.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ public function initalize()


$this->locations["Desert Palace - Big Key Chest"]->setRequirements(function ($locations, $items) {
return $items->has('KeyP2')
return $items->has('KeyP2') && $items->canKillMostThings($this->world)
&& ($items->has('MoonPearl')
|| $this->world->config('canDungeonRevive')
|| $this->world->config('canDungeonRevive', false)
|| ($this->world->config('canBunnyRevive', false)
&& $items->canBunnyRevive()) || ($this->world->config('canOWYBA', false)
&& $items->hasABottle()));
&& $items->hasABottle()) || $items->hasSword());
});


Expand All @@ -64,6 +64,8 @@ public function initalize()
&& $items->canBunnyRevive()) || ($this->world->config('canOWYBA', false)
&& $items->hasABottle())) || ($this->world->config('canOneFrameClipOW', false)
&& $this->world->config('canDungeonRevive', false)))
&& ($items->canLiftRocks() || ($this->world->config('canBootsClip', false)
&& $items->has('PegasusBoots')) || $this->world->config('canOneFrameClipOW', false))
&& $items->canLightTorches()
&& $items->has('BigKeyP2')
&& $items->has('KeyP2')
Expand All @@ -80,8 +82,7 @@ public function initalize()
$this->can_enter = function ($locations, $items) use ($main, $side, $thieves) {
return ($this->world->config('canDungeonRevive', false)
|| ($this->world->config('canSuperBunny', false)
&& ($items->has('MagicMirror')
&& $items->has('BookOfMudora'))) || ($this->world->config('canBunnyRevive', false)
&& $items->has('MagicMirror')) || ($this->world->config('canBunnyRevive', false)
&& $items->canBunnyRevive()) || ($this->world->config('canOWYBA', false)
&& $items->hasABottle()) ||
$items->has('MoonPearl')) && ($main($locations, $items)
Expand Down
4 changes: 2 additions & 2 deletions app/Region/Inverted/EasternPalace.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ public function initalize()
|| ($this->world->config('canBunnyRevive', false)
&& $items->canBunnyRevive()) || ($this->world->config('canOWYBA', false)
&& $items->hasABottle()) ||
$items->has('MoonPearl')) && $items->has('Lamp');
$items->has('MoonPearl')) && $items->has('Lamp', $this->world->config('item.require.Lamp', 1));
});

$this->locations["Eastern Palace - Boss"]->setRequirements(function ($locations, $items) {
return $items->canShootArrows()
return $items->canShootArrows($this->world)
&& ($this->world->config('canDungeonRevive', false)
|| ($this->world->config('canBunnyRevive', false)
&& $items->canBunnyRevive()) || ($this->world->config('canOWYBA', false)
Expand Down
Loading

0 comments on commit 4499559

Please sign in to comment.