KH: what? yeah, it's HK (#420)

* KH: what? yeah, it's HK
someone this hadn't been spotted yet.

* KH: also fix the start AST Node, just in case we add those in at some point (currently they resolve to True/False anyway)
This commit is contained in:
Fabian Dill 2022-04-05 15:01:33 +02:00 committed by GitHub
parent f2055daf1a
commit 2def8f35ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 398 additions and 400 deletions

View File

@ -107,7 +107,7 @@ class Absorber(ast.NodeTransformer):
return ast.Constant(False, ctx=node.ctx)
if node.id in logic_options:
return ast.Call(
func=ast.Attribute(value=ast.Name(id='state', ctx=ast.Load()), attr='_kh_option', ctx=ast.Load()),
func=ast.Attribute(value=ast.Name(id='state', ctx=ast.Load()), attr='_hk_option', ctx=ast.Load()),
args=[ast.Name(id="player", ctx=ast.Load()), ast.Constant(value=logic_options[node.id])], keywords=[])
if node.id in macros:
return macros[node.id].body
@ -143,7 +143,7 @@ class Absorber(ast.NodeTransformer):
if node.slice.value in removed_starts:
return ast.Constant(False, ctx=node.ctx)
return ast.Call(
func=ast.Attribute(value=ast.Name(id='state', ctx=ast.Load()), attr='_kh_start', ctx=ast.Load()),
func=ast.Attribute(value=ast.Name(id='state', ctx=ast.Load()), attr='_hk_start', ctx=ast.Load()),
args=[ast.Name(id="player", ctx=ast.Load()), node.slice], keywords=[])
elif node.value.id == "COMBAT":
return macros[unparse(node)].body

File diff suppressed because it is too large Load Diff

View File

@ -328,10 +328,8 @@ class HKLogicMixin(LogicMixin):
def _hk_notches(self, player: int, *notches: int) -> int:
return sum(self.world.worlds[player].charm_costs[notch] for notch in notches)
def _kh_option(self, player: int, option_name: str) -> int:
if option_name == "RandomizeCharmNotches":
return self.world.RandomCharmCosts[player] != -1
def _hk_option(self, player: int, option_name: str) -> int:
return getattr(self.world, option_name)[player].value
def _kh_start(self, player, start_location: str) -> bool:
def _hk_start(self, player, start_location: str) -> bool:
return self.world.StartLocation[player] == start_location