Merged DR v1.0.1.3

This commit is contained in:
codemann8
2022-09-07 22:44:11 -05:00
9 changed files with 30 additions and 18 deletions

View File

@@ -62,9 +62,9 @@ class KeyLogic(object):
self.sm_doors = {}
self.prize_location = None
def check_placement(self, unplaced_keys, big_key_loc=None, prize_loc=None, cr_count=7):
def check_placement(self, unplaced_keys, wild_keys, big_key_loc=None, prize_loc=None, cr_count=7):
for rule in self.placement_rules:
if not rule.is_satisfiable(self.outside_keys, unplaced_keys, big_key_loc, prize_loc, cr_count):
if not rule.is_satisfiable(self.outside_keys, wild_keys, unplaced_keys, big_key_loc, prize_loc, cr_count):
return False
if big_key_loc:
for rule_a, rule_b in itertools.combinations(self.placement_rules, 2):
@@ -158,7 +158,7 @@ class PlacementRule(object):
left -= rule_needed
return False
def is_satisfiable(self, outside_keys, unplaced_keys, big_key_loc, prize_location, cr_count):
def is_satisfiable(self, outside_keys, wild_keys, unplaced_keys, big_key_loc, prize_location, cr_count):
if self.prize_relevance and prize_location:
if self.prize_relevance == 'BigBomb':
if prize_location.item.name not in ['Crystal 5', 'Crystal 6']:
@@ -186,17 +186,20 @@ class PlacementRule(object):
if not bk_blocked and check_locations is None:
return True
available_keys = outside_keys
empty_chests = 0
# todo: sometimes we need an extra empty chest to accomodate the big key too
# dungeon bias seed 563518200 for example
threshold = self.needed_keys_wo_bk if bk_blocked else self.needed_keys_w_bk
for loc in check_locations:
if not loc.item:
empty_chests += 1
elif loc.item and loc.item.name == self.small_key:
available_keys += 1
place_able_keys = min(empty_chests, unplaced_keys)
available_keys += place_able_keys
if not wild_keys:
empty_chests = 0
for loc in check_locations:
if not loc.item:
empty_chests += 1
elif loc.item and loc.item.name == self.small_key:
available_keys += 1
place_able_keys = min(empty_chests, unplaced_keys)
available_keys += place_able_keys
else:
available_keys += unplaced_keys
return available_keys >= threshold