5
5
from random import Random
6
6
from typing import Any , ClassVar , Dict , get_type_hints , Iterator , List , Set , Tuple
7
7
8
- from BaseClasses import Entrance , Item , ItemClassification , MultiWorld , Region , Tutorial
8
+ from BaseClasses import Entrance , Item , ItemClassification , Location , MultiWorld , Region , Tutorial
9
9
from Options import AssembleOptions
10
10
from Utils import __version__
11
11
from worlds .AutoWorld import WebWorld , World
@@ -50,10 +50,11 @@ class L2ACWorld(World):
50
50
item_name_groups : ClassVar [Dict [str , Set [str ]]] = {
51
51
"Blue chest items" : {name for name , data in l2ac_item_table .items () if data .type is ItemType .BLUE_CHEST },
52
52
"Capsule monsters" : {name for name , data in l2ac_item_table .items () if data .type is ItemType .CAPSULE_MONSTER },
53
+ "Iris treasures" : {name for name , data in l2ac_item_table .items () if data .type is ItemType .IRIS_TREASURE },
53
54
"Party members" : {name for name , data in l2ac_item_table .items () if data .type is ItemType .PARTY_MEMBER },
54
55
}
55
- data_version : ClassVar [int ] = 1
56
- required_client_version : Tuple [int , int , int ] = (0 , 3 , 6 )
56
+ data_version : ClassVar [int ] = 2
57
+ required_client_version : Tuple [int , int , int ] = (0 , 4 , 2 )
57
58
58
59
# L2ACWorld specific properties
59
60
rom_name : bytearray
@@ -107,17 +108,20 @@ def create_regions(self) -> None:
107
108
L2ACLocation (self .player , f"Chest access { i + 1 } -{ i + CHESTS_PER_SPHERE } " , None , ancient_dungeon )
108
109
chest_access .place_locked_item (prog_chest_access )
109
110
ancient_dungeon .locations .append (chest_access )
110
- treasures = L2ACLocation (self .player , "Iris Treasures" , None , ancient_dungeon )
111
- treasures .place_locked_item (L2ACItem ("Treasures collected" , ItemClassification .progression , None , self .player ))
112
- ancient_dungeon .locations .append (treasures )
111
+ for iris in self .item_name_groups ["Iris treasures" ]:
112
+ treasure_name : str = f"Iris treasure { self .item_name_to_id [iris ] - self .item_name_to_id ['Iris sword' ] + 1 } "
113
+ iris_treasure : Location = \
114
+ L2ACLocation (self .player , treasure_name , self .location_name_to_id [treasure_name ], ancient_dungeon )
115
+ iris_treasure .place_locked_item (self .create_item (iris ))
116
+ ancient_dungeon .locations .append (iris_treasure )
113
117
self .multiworld .regions .append (ancient_dungeon )
114
118
115
119
final_floor = Region ("FinalFloor" , self .player , self .multiworld , "Ancient Cave Final Floor" )
116
120
ff_reached = L2ACLocation (self .player , "Final Floor reached" , None , final_floor )
117
121
ff_reached .place_locked_item (L2ACItem ("Final Floor access" , ItemClassification .progression , None , self .player ))
118
122
final_floor .locations .append (ff_reached )
119
- boss = L2ACLocation (self .player , "Boss" , None , final_floor )
120
- boss .place_locked_item (L2ACItem ( "Boss victory" , ItemClassification . progression , None , self . player ))
123
+ boss : Location = L2ACLocation (self .player , "Boss" , self . location_name_to_id [ "Boss" ] , final_floor )
124
+ boss .place_locked_item (self . create_item ( "Ancient key" ))
121
125
final_floor .locations .append (boss )
122
126
self .multiworld .regions .append (final_floor )
123
127
@@ -155,8 +159,9 @@ def set_rules(self) -> None:
155
159
156
160
set_rule (self .multiworld .get_entrance ("FinalFloorEntrance" , self .player ),
157
161
lambda state : state .can_reach (f"Blue chest { self .o .blue_chest_count } " , "Location" , self .player ))
158
- set_rule (self .multiworld .get_location ("Iris Treasures" , self .player ),
159
- lambda state : state .can_reach (f"Blue chest { self .o .blue_chest_count } " , "Location" , self .player ))
162
+ for i in range (9 ):
163
+ set_rule (self .multiworld .get_location (f"Iris treasure { i + 1 } " , self .player ),
164
+ lambda state : state .can_reach (f"Blue chest { self .o .blue_chest_count } " , "Location" , self .player ))
160
165
set_rule (self .multiworld .get_location ("Boss" , self .player ),
161
166
lambda state : state .can_reach (f"Blue chest { self .o .blue_chest_count } " , "Location" , self .player ))
162
167
if self .o .shuffle_capsule_monsters :
@@ -170,13 +175,14 @@ def set_rules(self) -> None:
170
175
lambda state : state .has ("Final Floor access" , self .player )
171
176
elif self .o .goal == Goal .option_iris_treasure_hunt :
172
177
self .multiworld .completion_condition [self .player ] = \
173
- lambda state : state .has ( "Treasures collected " , self .player )
178
+ lambda state : state .has_group ( "Iris treasures " , self .player , int ( self . o . iris_treasures_required ) )
174
179
elif self .o .goal == Goal .option_boss :
175
180
self .multiworld .completion_condition [self .player ] = \
176
- lambda state : state .has ("Boss victory " , self .player )
181
+ lambda state : state .has ("Ancient key " , self .player )
177
182
elif self .o .goal == Goal .option_boss_iris_treasure_hunt :
178
183
self .multiworld .completion_condition [self .player ] = \
179
- lambda state : state .has ("Boss victory" , self .player ) and state .has ("Treasures collected" , self .player )
184
+ lambda state : (state .has ("Ancient key" , self .player ) and
185
+ state .has_group ("Iris treasures" , self .player , int (self .o .iris_treasures_required )))
180
186
181
187
def generate_output (self , output_directory : str ) -> None :
182
188
rom_path : str = os .path .join (output_directory , f"{ self .multiworld .get_out_file_name_base (self .player )} .sfc" )
0 commit comments