1
- from BaseClasses import Entrance , Item , ItemClassification , Location , MultiWorld , Region , Tutorial
1
+ from typing import List
2
+
3
+ from BaseClasses import Region , Tutorial
2
4
from worlds .AutoWorld import WebWorld , World
3
- from worlds .generic .Rules import set_rule
5
+ from .Items import CliqueItem , item_data_table , item_table
6
+ from .Locations import CliqueLocation , location_data_table , location_table , locked_locations
4
7
from .Options import clique_options
5
-
6
-
7
- class CliqueItem (Item ):
8
- game = "Clique"
9
-
10
-
11
- class CliqueLocation (Location ):
12
- game = "Clique"
8
+ from .Regions import region_data_table
9
+ from .Rules import get_button_rule
13
10
14
11
15
12
class CliqueWebWorld (WebWorld ):
@@ -27,71 +24,69 @@ class CliqueWebWorld(WebWorld):
27
24
28
25
29
26
class CliqueWorld (World ):
30
- """The greatest game ever designed. Full of exciting gameplay! """
27
+ """The greatest game of all time. """
31
28
32
29
game = "Clique"
33
- data_version = 2
30
+ data_version = 3
34
31
web = CliqueWebWorld ()
35
32
option_definitions = clique_options
36
-
37
- # Yes, I'm like 12 for this.
38
- location_name_to_id = {
39
- "The Big Red Button" : 69696969 ,
40
- "The Item on the Desk" : 69696968 ,
41
- }
42
-
43
- item_name_to_id = {
44
- "Feeling of Satisfaction" : 69696969 ,
45
- "Button Activation" : 69696968 ,
46
- }
33
+ location_name_to_id = location_table
34
+ item_name_to_id = item_table
47
35
48
36
def create_item (self , name : str ) -> CliqueItem :
49
- return CliqueItem (name , ItemClassification . progression , self . item_name_to_id [name ], self .player )
37
+ return CliqueItem (name , item_data_table [ name ]. type , item_data_table [name ]. code , self .player )
50
38
51
39
def create_items (self ) -> None :
52
- self .multiworld .itempool .append (self .create_item ("Feeling of Satisfaction" ))
53
- self .multiworld .priority_locations [self .player ].value .add ("The Big Red Button" )
40
+ item_pool : List [CliqueItem ] = []
41
+ for name , item in item_data_table .items ():
42
+ if item .code and item .can_create (self .multiworld , self .player ):
43
+ item_pool .append (self .create_item (name ))
54
44
55
- if self .multiworld .hard_mode [self .player ]:
56
- self .multiworld .itempool .append (self .create_item ("Button Activation" ))
45
+ self .multiworld .itempool += item_pool
57
46
58
47
def create_regions (self ) -> None :
59
- if self .multiworld .hard_mode [self .player ]:
60
- self .multiworld .regions += [
61
- create_region (self .multiworld , self .player , "Menu" , None , ["The entrance to the button." ]),
62
- create_region (self .multiworld , self .player , "The realm of the button." , self .location_name_to_id )
63
- ]
64
- else :
65
- self .multiworld .regions += [
66
- create_region (self .multiworld , self .player , "Menu" , None , ["The entrance to the button." ]),
67
- create_region (self .multiworld , self .player , "The realm of the button." , {
68
- "The Big Red Button" : 69696969
69
- })]
70
-
71
- self .multiworld .get_entrance ("The entrance to the button." , self .player ) \
72
- .connect (self .multiworld .get_region ("The realm of the button." , self .player ))
48
+ # Create regions.
49
+ for region_name in region_data_table .keys ():
50
+ region = Region (region_name , self .player , self .multiworld )
51
+ self .multiworld .regions .append (region )
52
+
53
+ # Create locations.
54
+ for region_name , region_data in region_data_table .items ():
55
+ region = self .multiworld .get_region (region_name , self .player )
56
+ region .add_locations ({
57
+ location_name : location_data .address for location_name , location_data in location_data_table .items ()
58
+ if location_data .region == region_name and location_data .can_create (self .multiworld , self .player )
59
+ }, CliqueLocation )
60
+ region .add_exits (region_data_table [region_name ].connecting_regions )
61
+
62
+ # Place locked locations.
63
+ for location_name , location_data in locked_locations .items ():
64
+ # Ignore locations we never created.
65
+ if not location_data .can_create (self .multiworld , self .player ):
66
+ continue
67
+
68
+ locked_item = self .create_item (location_data_table [location_name ].locked_item )
69
+ self .multiworld .get_location (location_name , self .player ).place_locked_item (locked_item )
70
+
71
+ # Set priority location for the Big Red Button!
72
+ self .multiworld .priority_locations [self .player ].value .add ("The Big Red Button" )
73
73
74
74
def get_filler_item_name (self ) -> str :
75
- return self . multiworld . random . choice ( self . item_name_to_id )
75
+ return "A Cool Filler Item (No Satisfaction Guaranteed)"
76
76
77
77
def set_rules (self ) -> None :
78
- if self .multiworld .hard_mode [self .player ]:
79
- set_rule (
80
- self .multiworld .get_location ("The Big Red Button" , self .player ),
81
- lambda state : state .has ("Button Activation" , self .player ))
82
-
83
- self .multiworld .completion_condition [self .player ] = lambda state : \
84
- state .has ("Feeling of Satisfaction" , self .player )
85
-
78
+ button_rule = get_button_rule (self .multiworld , self .player )
79
+ self .multiworld .get_location ("The Big Red Button" , self .player ).access_rule = button_rule
80
+ self .multiworld .get_location ("In the Player's Mind" , self .player ).access_rule = button_rule
86
81
87
- def create_region (world : MultiWorld , player : int , name : str , locations = None , exits = None ):
88
- region = Region (name , player , world )
89
- if locations :
90
- for location_name in locations .keys ():
91
- region .locations .append (CliqueLocation (player , location_name , locations [location_name ], region ))
82
+ # Do not allow button activations on buttons.
83
+ self .multiworld .get_location ("The Big Red Button" , self .player ).item_rule = \
84
+ lambda item : item .name != "Button Activation"
92
85
93
- if exits :
94
- for _exit in exits :
95
- region .exits .append (Entrance (player , _exit , region ))
86
+ # Completion condition.
87
+ self .multiworld .completion_condition [self .player ] = lambda state : state .has ("The Urge to Push" , self .player )
96
88
97
- return region
89
+ def fill_slot_data (self ):
90
+ return {
91
+ "color" : getattr (self .multiworld , "color" )[self .player ].current_key
92
+ }
0 commit comments