Skip to content

Commit

Permalink
Fix error with boss randomizer
Browse files Browse the repository at this point in the history
  • Loading branch information
LagoLunatic committed Aug 16, 2017
1 parent 349f31c commit 004bd70
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 51 deletions.
100 changes: 50 additions & 50 deletions randomizer.rb
Expand Up @@ -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()
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion randomizers/boss_randomizer.rb
Expand Up @@ -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.
Expand Down

0 comments on commit 004bd70

Please sign in to comment.