forked from ArchipelagoMW/Archipelago
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ChecksFinder: Refactor/Cleaning (ArchipelagoMW#3725)
* Update ChecksFinder * minor cleanup * Check for compatible name * Enable APWorld * Update setup_en.md * Update en_ChecksFinder.md * The client is getting updated instead * Qwint suggestions, ' -> ", streamline fill_slot_data * Oops, too many refactors --------- Co-authored-by: SunCat <[email protected]>
- Loading branch information
1 parent
98bb851
commit 90446ad
Showing
8 changed files
with
69 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,24 @@ | ||
from ..generic.Rules import set_rule | ||
from BaseClasses import MultiWorld, CollectionState | ||
from worlds.generic.Rules import set_rule | ||
from BaseClasses import MultiWorld | ||
|
||
|
||
def _has_total(state: CollectionState, player: int, total: int): | ||
return (state.count('Map Width', player) + state.count('Map Height', player) + | ||
state.count('Map Bombs', player)) >= total | ||
items = ["Map Width", "Map Height", "Map Bombs"] | ||
|
||
|
||
# Sets rules on entrances and advancements that are always applied | ||
def set_rules(world: MultiWorld, player: int): | ||
set_rule(world.get_location("Tile 6", player), lambda state: _has_total(state, player, 1)) | ||
set_rule(world.get_location("Tile 7", player), lambda state: _has_total(state, player, 2)) | ||
set_rule(world.get_location("Tile 8", player), lambda state: _has_total(state, player, 3)) | ||
set_rule(world.get_location("Tile 9", player), lambda state: _has_total(state, player, 4)) | ||
set_rule(world.get_location("Tile 10", player), lambda state: _has_total(state, player, 5)) | ||
set_rule(world.get_location("Tile 11", player), lambda state: _has_total(state, player, 6)) | ||
set_rule(world.get_location("Tile 12", player), lambda state: _has_total(state, player, 7)) | ||
set_rule(world.get_location("Tile 13", player), lambda state: _has_total(state, player, 8)) | ||
set_rule(world.get_location("Tile 14", player), lambda state: _has_total(state, player, 9)) | ||
set_rule(world.get_location("Tile 15", player), lambda state: _has_total(state, player, 10)) | ||
set_rule(world.get_location("Tile 16", player), lambda state: _has_total(state, player, 11)) | ||
set_rule(world.get_location("Tile 17", player), lambda state: _has_total(state, player, 12)) | ||
set_rule(world.get_location("Tile 18", player), lambda state: _has_total(state, player, 13)) | ||
set_rule(world.get_location("Tile 19", player), lambda state: _has_total(state, player, 14)) | ||
set_rule(world.get_location("Tile 20", player), lambda state: _has_total(state, player, 15)) | ||
set_rule(world.get_location("Tile 21", player), lambda state: _has_total(state, player, 16)) | ||
set_rule(world.get_location("Tile 22", player), lambda state: _has_total(state, player, 17)) | ||
set_rule(world.get_location("Tile 23", player), lambda state: _has_total(state, player, 18)) | ||
set_rule(world.get_location("Tile 24", player), lambda state: _has_total(state, player, 19)) | ||
set_rule(world.get_location("Tile 25", player), lambda state: _has_total(state, player, 20)) | ||
def set_rules(multiworld: MultiWorld, player: int): | ||
for i in range(20): | ||
set_rule(multiworld.get_location(f"Tile {i+6}", player), lambda state, i=i: state.has_from_list(items, player, i+1)) | ||
|
||
|
||
# Sets rules on completion condition | ||
def set_completion_rules(world: MultiWorld, player: int): | ||
|
||
width_req = 10-5 | ||
height_req = 10-5 | ||
bomb_req = 20-5 | ||
completion_requirements = lambda state: \ | ||
state.has("Map Width", player, width_req) and \ | ||
state.has("Map Height", player, height_req) and \ | ||
state.has("Map Bombs", player, bomb_req) | ||
world.completion_condition[player] = lambda state: completion_requirements(state) | ||
def set_completion_rules(multiworld: MultiWorld, player: int): | ||
width_req = 5 # 10 - 5 | ||
height_req = 5 # 10 - 5 | ||
bomb_req = 15 # 20 - 5 | ||
multiworld.completion_condition[player] = lambda state: state.has_all_counts( | ||
{ | ||
"Map Width": width_req, | ||
"Map Height": height_req, | ||
"Map Bombs": bomb_req, | ||
}, player) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters