Merged in DR v1.4.1.6
This commit is contained in:
70
Main.py
70
Main.py
@@ -18,13 +18,13 @@ from Regions import create_regions, create_shops, mark_light_dark_world_regions,
|
||||
from OWEdges import create_owedges
|
||||
from OverworldShuffle import link_overworld, update_world_regions, create_dynamic_exits
|
||||
from EntranceShuffle import link_entrances
|
||||
from Rom import patch_rom, patch_race_rom, patch_enemizer, apply_rom_settings, LocalRom, JsonRom, get_hash_string
|
||||
from Rom import patch_rom, patch_race_rom, apply_rom_settings, LocalRom, JsonRom, get_hash_string
|
||||
from Doors import create_doors
|
||||
from DoorShuffle import link_doors, connect_portal, link_doors_prep
|
||||
from RoomData import create_rooms
|
||||
from Rules import set_rules
|
||||
from Dungeons import create_dungeons
|
||||
from Fill import distribute_items_restrictive, promote_dungeon_items, fill_dungeons_restrictive, ensure_good_pots
|
||||
from Fill import distribute_items_restrictive, promote_dungeon_items, fill_dungeons_restrictive, ensure_good_items
|
||||
from Fill import dungeon_tracking
|
||||
from Fill import sell_potions, sell_keys, balance_multiworld_progression, balance_money_progression, lock_shop_locations, set_prize_drops
|
||||
from ItemList import generate_itempool, difficulties, fill_prizes, customize_shops, fill_specific_items, create_farm_locations
|
||||
@@ -36,8 +36,11 @@ from source.item.FillUtil import create_item_pool_config, massage_item_pool, dis
|
||||
from source.overworld.EntranceShuffle2 import link_entrances_new
|
||||
from source.tools.BPS import create_bps_from_data
|
||||
from source.classes.CustomSettings import CustomSettings
|
||||
from source.enemizer.DamageTables import DamageTable
|
||||
from source.enemizer.Enemizer import randomize_enemies
|
||||
from source.rom.DataTables import init_data_tables
|
||||
|
||||
version_number = '1.2.0.23'
|
||||
version_number = '1.4.1.6'
|
||||
version_branch = '-u'
|
||||
__version__ = f'{version_number}{version_branch}'
|
||||
|
||||
@@ -170,10 +173,13 @@ def main(args, seed=None, fish=None):
|
||||
create_doors(world, player)
|
||||
create_rooms(world, player)
|
||||
create_dungeons(world, player)
|
||||
adjust_locations(world, player)
|
||||
world.damage_table[player] = DamageTable()
|
||||
world.data_tables[player] = init_data_tables(world, player)
|
||||
place_bosses(world, player)
|
||||
randomize_enemies(world, player)
|
||||
if world.logic[player] in ('nologic', 'hybridglitches'):
|
||||
create_hybridmajor_connections(world, player)
|
||||
adjust_locations(world, player)
|
||||
|
||||
if any(world.potshuffle.values()):
|
||||
logger.info(world.fish.translate("cli", "cli", "shuffling.pots"))
|
||||
@@ -287,7 +293,7 @@ def main(args, seed=None, fish=None):
|
||||
customize_shops(world, player)
|
||||
if args.algorithm in ['balanced', 'equitable']:
|
||||
balance_money_progression(world)
|
||||
ensure_good_pots(world, True)
|
||||
ensure_good_items(world, True)
|
||||
|
||||
if args.print_custom_yaml:
|
||||
world.settings.record_info(world)
|
||||
@@ -300,34 +306,13 @@ def main(args, seed=None, fish=None):
|
||||
|
||||
rom_names = []
|
||||
jsonout = {}
|
||||
enemized = False
|
||||
if not args.suppress_rom or args.bps:
|
||||
logger.info(world.fish.translate("cli","cli","patching.rom"))
|
||||
for team in range(world.teams):
|
||||
for player in range(1, world.players + 1):
|
||||
sprite_random_on_hit = type(args.sprite[player]) is str and args.sprite[player].lower() == 'randomonhit'
|
||||
use_enemizer = (world.boss_shuffle[player] != 'none' or world.enemy_shuffle[player] != 'none'
|
||||
or world.enemy_health[player] != 'default' or world.enemy_damage[player] != 'default'
|
||||
or sprite_random_on_hit)
|
||||
rom = JsonRom() if args.jsonout else LocalRom(args.rom)
|
||||
|
||||
rom = JsonRom() if args.jsonout or use_enemizer else LocalRom(args.rom)
|
||||
|
||||
if use_enemizer and (args.enemizercli or not args.jsonout):
|
||||
local_rom = LocalRom(args.rom) # update base2current.json (side effect)
|
||||
if args.rom and not(os.path.isfile(args.rom)):
|
||||
raise RuntimeError("Could not find valid base rom for enemizing at expected path %s." % args.rom)
|
||||
if os.path.exists(args.enemizercli):
|
||||
patch_enemizer(world, player, rom, local_rom, args.enemizercli, sprite_random_on_hit)
|
||||
enemized = True
|
||||
if not args.jsonout:
|
||||
rom = LocalRom.fromJsonRom(rom, args.rom, 0x400000)
|
||||
else:
|
||||
enemizerMsg = world.fish.translate("cli","cli","enemizer.not.found") + ': ' + args.enemizercli + "\n"
|
||||
enemizerMsg += world.fish.translate("cli","cli","enemizer.nothing.applied")
|
||||
logging.warning(enemizerMsg)
|
||||
raise EnemizerError(enemizerMsg)
|
||||
|
||||
patch_rom(world, rom, player, team, enemized, bool(args.mystery))
|
||||
patch_rom(world, rom, player, team, bool(args.mystery))
|
||||
|
||||
if args.race:
|
||||
patch_race_rom(rom)
|
||||
@@ -380,6 +365,8 @@ def main(args, seed=None, fish=None):
|
||||
if args.create_spoiler and not args.jsonout:
|
||||
logger.info(world.fish.translate("cli", "cli", "patching.spoiler"))
|
||||
world.spoiler.to_file(output_path(f'{outfilebase}_Spoiler.txt'))
|
||||
if args.loglevel == 'debug':
|
||||
world.spoiler.extras(output_path(f'{outfilebase}_Spoiler.txt'))
|
||||
|
||||
if not args.skip_playthrough:
|
||||
logger.info(world.fish.translate("cli","cli","calc.playthrough"))
|
||||
@@ -403,7 +390,6 @@ def main(args, seed=None, fish=None):
|
||||
logger.info(world.fish.translate("cli","cli","made.rom") % (YES if (args.create_rom) else NO))
|
||||
logger.info(world.fish.translate("cli","cli","made.playthrough") % (YES if (args.calc_playthrough) else NO))
|
||||
logger.info(world.fish.translate("cli","cli","made.spoiler") % (YES if (not args.jsonout and args.create_spoiler) else NO))
|
||||
logger.info(world.fish.translate("cli","cli","used.enemizer") % (YES if enemized else NO))
|
||||
logger.info(world.fish.translate("cli","cli","seed") + ": %s", world.seed)
|
||||
logger.info(world.fish.translate("cli","cli","total.time"), time.perf_counter() - start)
|
||||
|
||||
@@ -483,6 +469,7 @@ def init_world(args, fish):
|
||||
world.enemy_shuffle = args.shuffleenemies.copy()
|
||||
world.enemy_health = args.enemy_health.copy()
|
||||
world.enemy_damage = args.enemy_damage.copy()
|
||||
world.any_enemy_logic = args.any_enemy_logic.copy()
|
||||
world.beemizer = args.beemizer.copy()
|
||||
world.intensity = {player: 'random' if args.intensity[player] == 'random' else int(args.intensity[player]) for player in range(1, world.players + 1)}
|
||||
world.door_type_mode = args.door_type_mode.copy()
|
||||
@@ -525,10 +512,11 @@ def set_starting_inventory(world, args):
|
||||
|
||||
if world.customizer and world.customizer.get_start_inventory():
|
||||
for p, inv_list in world.customizer.get_start_inventory().items():
|
||||
for inv_item in inv_list:
|
||||
item = ItemFactory(inv_item.strip(), p)
|
||||
if item:
|
||||
world.push_precollected(item)
|
||||
if inv_list:
|
||||
for inv_item in inv_list:
|
||||
item = ItemFactory(inv_item.strip(), p)
|
||||
if item:
|
||||
world.push_precollected(item)
|
||||
|
||||
|
||||
def copy_world(world):
|
||||
@@ -548,8 +536,6 @@ def copy_world(world):
|
||||
ret.treasure_hunt_count = world.treasure_hunt_count.copy()
|
||||
ret.treasure_hunt_icon = world.treasure_hunt_icon.copy()
|
||||
ret.sewer_light_cone = world.sewer_light_cone.copy()
|
||||
ret.light_world_light_cone = world.light_world_light_cone
|
||||
ret.dark_world_light_cone = world.dark_world_light_cone
|
||||
ret.seed = world.seed
|
||||
ret.can_access_trock_eyebridge = world.can_access_trock_eyebridge.copy()
|
||||
ret.can_access_trock_front = world.can_access_trock_front.copy()
|
||||
@@ -565,6 +551,7 @@ def copy_world(world):
|
||||
ret.bigkeyshuffle = world.bigkeyshuffle.copy()
|
||||
ret.bombbag = world.bombbag.copy()
|
||||
ret.flute_mode = world.flute_mode.copy()
|
||||
ret.bow_mode = world.bow_mode.copy()
|
||||
ret.crystals_needed_for_ganon = world.crystals_needed_for_ganon.copy()
|
||||
ret.crystals_needed_for_gt = world.crystals_needed_for_gt.copy()
|
||||
ret.crystals_ganon_orig = world.crystals_ganon_orig.copy()
|
||||
@@ -577,10 +564,12 @@ def copy_world(world):
|
||||
ret.open_pyramid = world.open_pyramid.copy()
|
||||
ret.shufflelinks = world.shufflelinks.copy()
|
||||
ret.shuffle_ganon = world.shuffle_ganon.copy()
|
||||
ret.take_any = world.take_any.copy()
|
||||
ret.boss_shuffle = world.boss_shuffle.copy()
|
||||
ret.enemy_shuffle = world.enemy_shuffle.copy()
|
||||
ret.enemy_health = world.enemy_health.copy()
|
||||
ret.enemy_damage = world.enemy_damage.copy()
|
||||
ret.any_enemy_logic = world.any_enemy_logic.copy()
|
||||
ret.beemizer = world.beemizer.copy()
|
||||
ret.intensity = world.intensity.copy()
|
||||
ret.decoupledoors = world.decoupledoors.copy()
|
||||
@@ -601,6 +590,8 @@ def copy_world(world):
|
||||
ret.prizes = world.prizes.copy()
|
||||
ret.restrict_boss_items = world.restrict_boss_items.copy()
|
||||
ret.inaccessible_regions = world.inaccessible_regions.copy()
|
||||
ret.damage_table = world.damage_table
|
||||
ret.data_tables = world.data_tables # can be changed...
|
||||
|
||||
for player in range(1, world.players + 1):
|
||||
create_regions(ret, player)
|
||||
@@ -740,8 +731,6 @@ def copy_world_premature(world, player):
|
||||
ret.treasure_hunt_count = world.treasure_hunt_count.copy()
|
||||
ret.treasure_hunt_icon = world.treasure_hunt_icon.copy()
|
||||
ret.sewer_light_cone = world.sewer_light_cone.copy()
|
||||
ret.light_world_light_cone = world.light_world_light_cone
|
||||
ret.dark_world_light_cone = world.dark_world_light_cone
|
||||
ret.seed = world.seed
|
||||
ret.can_access_trock_eyebridge = world.can_access_trock_eyebridge.copy()
|
||||
ret.can_access_trock_front = world.can_access_trock_front.copy()
|
||||
@@ -756,6 +745,8 @@ def copy_world_premature(world, player):
|
||||
ret.keyshuffle = world.keyshuffle.copy()
|
||||
ret.bigkeyshuffle = world.bigkeyshuffle.copy()
|
||||
ret.bombbag = world.bombbag.copy()
|
||||
ret.flute_mode = world.flute_mode.copy()
|
||||
ret.bow_mode = world.bow_mode.copy()
|
||||
ret.crystals_needed_for_ganon = world.crystals_needed_for_ganon.copy()
|
||||
ret.crystals_needed_for_gt = world.crystals_needed_for_gt.copy()
|
||||
ret.crystals_ganon_orig = world.crystals_ganon_orig.copy()
|
||||
@@ -768,10 +759,12 @@ def copy_world_premature(world, player):
|
||||
ret.open_pyramid = world.open_pyramid.copy()
|
||||
ret.shufflelinks = world.shufflelinks.copy()
|
||||
ret.shuffle_ganon = world.shuffle_ganon.copy()
|
||||
ret.take_any = world.take_any.copy()
|
||||
ret.boss_shuffle = world.boss_shuffle.copy()
|
||||
ret.enemy_shuffle = world.enemy_shuffle.copy()
|
||||
ret.enemy_health = world.enemy_health.copy()
|
||||
ret.enemy_damage = world.enemy_damage.copy()
|
||||
ret.any_enemy_logic = world.any_enemy_logic.copy()
|
||||
ret.beemizer = world.beemizer.copy()
|
||||
ret.intensity = world.intensity.copy()
|
||||
ret.decoupledoors = world.decoupledoors.copy()
|
||||
@@ -791,6 +784,9 @@ def copy_world_premature(world, player):
|
||||
ret.owflutespots = world.owflutespots.copy()
|
||||
ret.prizes = world.prizes.copy()
|
||||
ret.restrict_boss_items = world.restrict_boss_items.copy()
|
||||
ret.inaccessible_regions = world.inaccessible_regions.copy()
|
||||
ret.damage_table = world.damage_table
|
||||
ret.data_tables = world.data_tables # can be changed...
|
||||
ret.key_logic = world.key_logic.copy()
|
||||
|
||||
ret.is_copied_world = True
|
||||
|
||||
Reference in New Issue
Block a user