From 004bd70218b1cdf402ce0ba41df945dc550666ec Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Wed, 16 Aug 2017 17:49:38 -0400 Subject: [PATCH] Fix error with boss randomizer #24 --- randomizer.rb | 100 ++++++++++++++++----------------- randomizers/boss_randomizer.rb | 3 +- 2 files changed, 52 insertions(+), 51 deletions(-) diff --git a/randomizer.rb b/randomizer.rb index d5d2731..4926e51 100644 --- a/randomizer.rb +++ b/randomizer.rb @@ -338,6 +338,56 @@ def randomize apply_pre_randomization_tweaks() + @max_up_items = [] + if options[:randomize_consumable_behavior] + reset_rng() + case GAME + when "por" + possible_max_up_ids = (0..0x5F).to_a - checker.all_progression_pickups - NONRANDOMIZABLE_PICKUP_GLOBAL_IDS + possible_max_up_ids -= [0x00, 0x04] # Don't let starting items (potion and high tonic) be max ups. + possible_max_up_ids -= [0x3F] # Don't let ground meat by a max up since you can farm it infinitely. + possible_max_up_ids -= [0x45, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F] # Don't let magical tickets and records be max ups since other types of items can't be made magical tickets or max ups. + 2.times do + max_up_id = possible_max_up_ids.sample(random: rng) + possible_max_up_ids.delete(max_up_id) + @max_up_items << max_up_id + end + when "ooe" + possible_max_up_ids = (0x75..0xE4).to_a - checker.all_progression_pickups - NONRANDOMIZABLE_PICKUP_GLOBAL_IDS + possible_max_up_ids -= [0x75, 0x79] # Don't let starting items (potion and high tonic) be max ups. + possible_max_up_ids -= [0xD2] # VIP card given to you by Jacob and put directly into your inventory. + 3.times do + max_up_id = possible_max_up_ids.sample(random: rng) + possible_max_up_ids.delete(max_up_id) + @max_up_items << max_up_id + end + end + else + case GAME + when "por" + @max_up_items = [0x08, 0x09] + when "ooe" + @max_up_items = [0x7F, 0x80, 0x81] + end + end + + @red_wall_souls = [] + if GAME == "dos" + if options[:randomize_red_walls] + randomize_red_walls() + else + @red_wall_souls = [ + 0xD2, # skeleton + 0xD4, # axe armor + 0xE3, # killer clown + 0xEC, # ukoback + ] + end + + # Tell the completability checker logic what souls are for what red walls on this seed. + checker.set_red_wall_souls(@red_wall_souls) + end + if options[:randomize_bosses] yield [options_completed, "Shuffling bosses..."] reset_rng() @@ -393,56 +443,6 @@ def randomize end end - @max_up_items = [] - if options[:randomize_consumable_behavior] - reset_rng() - case GAME - when "por" - possible_max_up_ids = (0..0x5F).to_a - checker.all_progression_pickups - NONRANDOMIZABLE_PICKUP_GLOBAL_IDS - possible_max_up_ids -= [0x00, 0x04] # Don't let starting items (potion and high tonic) be max ups. - possible_max_up_ids -= [0x3F] # Don't let ground meat by a max up since you can farm it infinitely. - possible_max_up_ids -= [0x45, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F] # Don't let magical tickets and records be max ups since other types of items can't be made magical tickets or max ups. - 2.times do - max_up_id = possible_max_up_ids.sample(random: rng) - possible_max_up_ids.delete(max_up_id) - @max_up_items << max_up_id - end - when "ooe" - possible_max_up_ids = (0x75..0xE4).to_a - checker.all_progression_pickups - NONRANDOMIZABLE_PICKUP_GLOBAL_IDS - possible_max_up_ids -= [0x75, 0x79] # Don't let starting items (potion and high tonic) be max ups. - possible_max_up_ids -= [0xD2] # VIP card given to you by Jacob and put directly into your inventory. - 3.times do - max_up_id = possible_max_up_ids.sample(random: rng) - possible_max_up_ids.delete(max_up_id) - @max_up_items << max_up_id - end - end - else - case GAME - when "por" - @max_up_items = [0x08, 0x09] - when "ooe" - @max_up_items = [0x7F, 0x80, 0x81] - end - end - - @red_wall_souls = [] - if GAME == "dos" - if options[:randomize_red_walls] - randomize_red_walls() - else - @red_wall_souls = [ - 0xD2, # skeleton - 0xD4, # axe armor - 0xE3, # killer clown - 0xEC, # ukoback - ] - end - - # Tell the completability checker logic what souls are for what red walls on this seed. - checker.set_red_wall_souls(@red_wall_souls) - end - @used_pickup_flags = [] # Specifies which pickup flags weren't used in the original game in case we need new ones for something. diff --git a/randomizers/boss_randomizer.rb b/randomizers/boss_randomizer.rb index fee952c..fcad148 100644 --- a/randomizers/boss_randomizer.rb +++ b/randomizers/boss_randomizer.rb @@ -122,7 +122,8 @@ def randomize_bosses if old_boss["Soul"] == 0xFF # Some bosses such as Flying Armor won't open the boss doors until the player gets their soul drop. # So we have to make sure no bosses have no soul drop (FF). - queued_dna_changes[new_boss_id]["Soul"] = get_unplaced_non_progression_skill() - SKILL_GLOBAL_ID_RANGE.begin + non_progression_souls = SKILL_GLOBAL_ID_RANGE.to_a - checker.all_progression_pickups - NONRANDOMIZABLE_PICKUP_GLOBAL_IDS + queued_dna_changes[new_boss_id]["Soul"] = non_progression_souls.sample(random: rng) - SKILL_GLOBAL_ID_RANGE.begin end # Make the new boss have the stats of the old boss so it fits in at this point in the game.