fix: minor fix for take_anys

fix: money balancing - initialization in a good case
This commit is contained in:
aerinon
2023-12-13 13:59:34 -07:00
parent af03a8a243
commit c4ec28da76
3 changed files with 7 additions and 1 deletions

View File

@@ -1467,6 +1467,9 @@ class Region(object):
return self.dungeon and self.dungeon.is_dungeon_item(item) and item.player == self.player
return True
def is_outdoors(self):
return self.type in {RegionType.LightWorld, RegionType.DarkWorld}
def __str__(self):
return str(self.__unicode__())

View File

@@ -969,6 +969,7 @@ def balance_money_progression(world):
logger.debug(f'Money balancing needed: Player {target_player} short {difference}')
else:
difference = 0
target_player = next(p for p in solvent)
while difference > 0:
swap_targets = [x for x in unchecked_locations if x not in sphere_locations and x.item.name.startswith('Rupees') and x.item.player == target_player]
if len(swap_targets) == 0:

View File

@@ -518,7 +518,9 @@ def set_up_take_anys(world, player, skip_adjustments=False):
world.dynamic_regions.append(take_any)
target, room_id = random.choice([(0x58, 0x0112), (0x60, 0x010F), (0x46, 0x011F)])
reg = regions.pop()
entrance = world.get_region(reg, player).entrances[0]
entrance = next((ent for ent in world.get_region(reg, player).entrances if ent.parent_region.is_outdoors()), None)
if entrance is None:
raise Exception(f'No outside entrance found for {reg}')
connect_entrance(world, entrance, take_any, player)
entrance.target = target
take_any.shop = Shop(take_any, room_id, take_any_type, 0xE3, True, not world.shopsanity[player], 33 + num*2)