Skip to content

Commit c8ab49c

Browse files
JaredWeakStrikeExempt-Medic
authored andcommitted
KH2: Update all instances of multiworld.option_name to option.option_name (ArchipelagoMW#2634)
* update the multiworld to options * Update worlds/kh2/Rules.py Co-authored-by: Exempt-Medic <[email protected]> * does this work * namine sketches * wrong branch :) --------- Co-authored-by: Exempt-Medic <[email protected]>
1 parent 5d7b773 commit c8ab49c

File tree

4 files changed

+65
-63
lines changed

4 files changed

+65
-63
lines changed

worlds/kh2/OpenKH.py

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -54,29 +54,30 @@ def increaseStat(i):
5454
formName = None
5555
levelsetting = list()
5656

57-
if self.multiworld.Keyblade_Minimum[self.player].value > self.multiworld.Keyblade_Maximum[self.player].value:
57+
if self.options.Keyblade_Minimum.value > self.options.Keyblade_Maximum.value:
5858
logging.info(
5959
f"{self.multiworld.get_file_safe_player_name(self.player)} has Keyblade Minimum greater than Keyblade Maximum")
60-
keyblademin = self.multiworld.Keyblade_Maximum[self.player].value
61-
keyblademax = self.multiworld.Keyblade_Minimum[self.player].value
60+
keyblademin = self.options.Keyblade_Maximum.value
61+
keyblademax = self.options.Keyblade_Minimum.value
6262
else:
63-
keyblademin = self.multiworld.Keyblade_Minimum[self.player].value
64-
keyblademax = self.multiworld.Keyblade_Maximum[self.player].value
63+
keyblademin = self.options.Keyblade_Minimum.value
64+
keyblademax = self.options.Keyblade_Maximum.value
6565

66-
if self.multiworld.LevelDepth[self.player] == "level_50":
66+
if self.options.LevelDepth == "level_50":
6767
levelsetting.extend(exclusion_table["Level50"])
6868

69-
elif self.multiworld.LevelDepth[self.player] == "level_99":
69+
elif self.options.LevelDepth == "level_99":
7070
levelsetting.extend(exclusion_table["Level99"])
7171

72-
elif self.multiworld.LevelDepth[self.player] != "level_1":
72+
elif self.options.LevelDepth != "level_1":
7373
levelsetting.extend(exclusion_table["Level50Sanity"])
7474

75-
if self.multiworld.LevelDepth[self.player] == "level_99_sanity":
75+
if self.options.LevelDepth == "level_99_sanity":
7676
levelsetting.extend(exclusion_table["Level99Sanity"])
7777

7878
mod_name = f"AP-{self.multiworld.seed_name}-P{self.player}-{self.multiworld.get_file_safe_player_name(self.player)}"
7979
all_valid_locations = {location for location, data in all_locations.items()}
80+
8081
for location in self.multiworld.get_filled_locations(self.player):
8182
if location.name in all_valid_locations:
8283
data = all_locations[location.name]
@@ -142,11 +143,11 @@ def increaseStat(i):
142143
if data.locid == 2:
143144
formDict = {1: "Valor", 2: "Wisdom", 3: "Limit", 4: "Master", 5: "Final"}
144145
formDictExp = {
145-
1: self.multiworld.Valor_Form_EXP[self.player].value,
146-
2: self.multiworld.Wisdom_Form_EXP[self.player].value,
147-
3: self.multiworld.Limit_Form_EXP[self.player].value,
148-
4: self.multiworld.Master_Form_EXP[self.player].value,
149-
5: self.multiworld.Final_Form_EXP[self.player].value
146+
1: self.options.Valor_Form_EXP.value,
147+
2: self.options.Wisdom_Form_EXP.value,
148+
3: self.options.Limit_Form_EXP.value,
149+
4: self.options.Master_Form_EXP.value,
150+
5: self.options.Final_Form_EXP.value
150151
}
151152
formexp = formDictExp[data.charName]
152153
formName = formDict[data.charName]
@@ -172,7 +173,7 @@ def increaseStat(i):
172173
for x in range(1, 7):
173174
self.formattedFmlv["Summon"].append({
174175
"Ability": 123,
175-
"Experience": int(formExp[0][x] / self.multiworld.Summon_EXP[self.player].value),
176+
"Experience": int(formExp[0][x] / self.options.Summon_EXP.value),
176177
"FormId": 0,
177178
"FormLevel": x,
178179
"GrowthAbilityLevel": 0,
@@ -192,7 +193,7 @@ def increaseStat(i):
192193
increaseStat(self.random.randint(0, 3))
193194
itemcode = 0
194195
self.formattedLvup["Sora"][self.i] = {
195-
"Exp": int(soraExp[self.i] / self.multiworld.Sora_Level_EXP[self.player].value),
196+
"Exp": int(soraExp[self.i] / self.options.Sora_Level_EXP.value),
196197
"Strength": self.strength,
197198
"Magic": self.magic,
198199
"Defense": self.defense,
@@ -224,7 +225,7 @@ def increaseStat(i):
224225
"Unknown": 0
225226
})
226227
self.formattedLvup["Sora"][1] = {
227-
"Exp": int(soraExp[1] / self.multiworld.Sora_Level_EXP[self.player].value),
228+
"Exp": int(soraExp[1] / self.options.Sora_Level_EXP.value),
228229
"Strength": 2,
229230
"Magic": 6,
230231
"Defense": 2,
@@ -379,35 +380,35 @@ def increaseStat(i):
379380
}
380381
lucky_emblem_text = {
381382
0: "Your Goal is not Lucky Emblem. It is Hitlist or Three Proofs.",
382-
1: f"Lucky Emblem Required: {self.multiworld.LuckyEmblemsRequired[self.player]} out of {self.multiworld.LuckyEmblemsAmount[self.player]}",
383+
1: f"Lucky Emblem Required: {self.options.LuckyEmblemsRequired} out of {self.options.LuckyEmblemsAmount}",
383384
2: "Your Goal is not Lucky Emblem. It is Hitlist or Three Proofs.",
384-
3: f"Lucky Emblem Required: {self.multiworld.LuckyEmblemsRequired[self.player]} out of {self.multiworld.LuckyEmblemsAmount[self.player]}"
385+
3: f"Lucky Emblem Required: {self.options.LuckyEmblemsRequired} out of {self.options.LuckyEmblemsAmount}"
385386
}
386387
hitlist_text = {
387388
0: "Your Goal is not Hitlist. It is Lucky Emblem or Three Proofs",
388389
1: "Your Goal is not Hitlist. It is Lucky Emblem or Three Proofs",
389-
2: f"Bounties Required: {self.multiworld.BountyRequired[self.player]} out of {self.multiworld.BountyAmount[self.player]}",
390-
3: f"Bounties Required: {self.multiworld.BountyRequired[self.player]} out of {self.multiworld.BountyAmount[self.player]}",
390+
2: f"Bounties Required: {self.options.BountyRequired} out of {self.options.BountyAmount}",
391+
3: f"Bounties Required: {self.options.BountyRequired} out of {self.options.BountyAmount}",
391392
}
392393

393394
self.pooh_text = [
394395
{
395396
'id': 18326,
396-
'en': f"Your goal is {goal_to_text[self.multiworld.Goal[self.player].value]}"
397+
'en': f"Your goal is {goal_to_text[self.options.Goal.value]}"
397398
},
398399
{
399400
'id': 18327,
400-
'en': lucky_emblem_text[self.multiworld.Goal[self.player].value]
401+
'en': lucky_emblem_text[self.options.Goal.value]
401402
},
402403
{
403404
'id': 18328,
404-
'en': hitlist_text[self.multiworld.Goal[self.player].value]
405+
'en': hitlist_text[self.options.Goal.value]
405406
}
406407
]
407408
self.level_depth_text = [
408409
{
409410
'id': 0x3BF1,
410-
'en': f"Your Level Depth is {self.multiworld.LevelDepth[self.player].current_option_name}"
411+
'en': f"Your Level Depth is {self.options.LevelDepth.current_option_name}"
411412
}
412413
]
413414
mod_dir = os.path.join(output_directory, mod_name + "_" + Utils.__version__)

worlds/kh2/Regions.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ def create_regions(self):
935935

936936
for level_region_name in level_region_list:
937937
KH2REGIONS[level_region_name] = []
938-
if multiworld.LevelDepth[player] == "level_50":
938+
if self.options.LevelDepth == "level_50":
939939
KH2REGIONS[RegionName.LevelsVS1] = [LocationName.Lvl2, LocationName.Lvl4, LocationName.Lvl7, LocationName.Lvl9,
940940
LocationName.Lvl10]
941941
KH2REGIONS[RegionName.LevelsVS3] = [LocationName.Lvl12, LocationName.Lvl14, LocationName.Lvl15,
@@ -949,7 +949,7 @@ def create_regions(self):
949949
KH2REGIONS[RegionName.LevelsVS15] = [LocationName.Lvl50]
950950

951951
# level 99
952-
elif multiworld.LevelDepth[player] == "level_99":
952+
elif self.options.LevelDepth == "level_99":
953953
KH2REGIONS[RegionName.LevelsVS1] = [LocationName.Lvl7, LocationName.Lvl9]
954954
KH2REGIONS[RegionName.LevelsVS3] = [LocationName.Lvl12, LocationName.Lvl15, LocationName.Lvl17,
955955
LocationName.Lvl20]
@@ -965,7 +965,7 @@ def create_regions(self):
965965
KH2REGIONS[RegionName.LevelsVS26] = [LocationName.Lvl99]
966966
# level sanity
967967
# has to be [] instead of {} for in
968-
elif multiworld.LevelDepth[player] in ["level_50_sanity", "level_99_sanity"]:
968+
elif self.options.LevelDepth in ["level_50_sanity", "level_99_sanity"]:
969969
KH2REGIONS[RegionName.LevelsVS1] = [LocationName.Lvl2, LocationName.Lvl3, LocationName.Lvl4, LocationName.Lvl5,
970970
LocationName.Lvl6,
971971
LocationName.Lvl7, LocationName.Lvl8, LocationName.Lvl9, LocationName.Lvl10]
@@ -986,7 +986,7 @@ def create_regions(self):
986986
LocationName.Lvl46, LocationName.Lvl47, LocationName.Lvl48,
987987
LocationName.Lvl49, LocationName.Lvl50]
988988
# level 99 sanity
989-
if multiworld.LevelDepth[player] == "level_99_sanity":
989+
if self.options.LevelDepth == "level_99_sanity":
990990
KH2REGIONS[RegionName.LevelsVS15] = [LocationName.Lvl51, LocationName.Lvl52, LocationName.Lvl53,
991991
LocationName.Lvl54,
992992
LocationName.Lvl55, LocationName.Lvl56, LocationName.Lvl57,
@@ -1012,7 +1012,7 @@ def create_regions(self):
10121012
LocationName.Lvl95, LocationName.Lvl96, LocationName.Lvl97,
10131013
LocationName.Lvl98, LocationName.Lvl99]
10141014
KH2REGIONS[RegionName.Summon] = []
1015-
if multiworld.SummonLevelLocationToggle[player]:
1015+
if self.options.SummonLevelLocationToggle:
10161016
KH2REGIONS[RegionName.Summon] = [LocationName.Summonlvl2,
10171017
LocationName.Summonlvl3,
10181018
LocationName.Summonlvl4,

worlds/kh2/Rules.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def kh2_has_any(self, items: list, state: CollectionState):
157157

158158
def form_list_unlock(self, state: CollectionState, parent_form_list, level_required, fight_logic=False) -> bool:
159159
form_access = {parent_form_list}
160-
if self.multiworld.AutoFormLogic[self.player] and state.has(ItemName.SecondChance, self.player) and not fight_logic:
160+
if self.world.options.AutoFormLogic and state.has(ItemName.SecondChance, self.player) and not fight_logic:
161161
if parent_form_list == ItemName.MasterForm:
162162
if state.has(ItemName.DriveConverter, self.player):
163163
form_access.add(auto_form_dict[parent_form_list])
@@ -170,8 +170,8 @@ def get_form_level_requirement(self, state, amount):
170170
forms_available = 0
171171
form_list = [ItemName.ValorForm, ItemName.WisdomForm, ItemName.LimitForm, ItemName.MasterForm,
172172
ItemName.FinalForm]
173-
if self.world.multiworld.FinalFormLogic[self.player] != "no_light_and_darkness":
174-
if self.world.multiworld.FinalFormLogic[self.player] == "light_and_darkness":
173+
if self.world.options.FinalFormLogic != "no_light_and_darkness":
174+
if self.world.options.FinalFormLogic == "light_and_darkness":
175175
if state.has(ItemName.LightDarkness, self.player) and state.has_any(set(form_list), self.player):
176176
forms_available += 1
177177
form_list.remove(ItemName.FinalForm)
@@ -273,34 +273,35 @@ def set_kh2_rules(self) -> None:
273273

274274
def set_kh2_goal(self):
275275
final_xemnas_location = self.multiworld.get_location(LocationName.FinalXemnasEventLocation, self.player)
276-
if self.multiworld.Goal[self.player] == "three_proofs":
276+
if self.world.options.Goal == "three_proofs":
277277
final_xemnas_location.access_rule = lambda state: self.kh2_has_all(three_proofs, state)
278-
if self.multiworld.FinalXemnas[self.player]:
278+
if self.world.options.FinalXemnas:
279279
self.multiworld.completion_condition[self.player] = lambda state: state.has(ItemName.Victory, self.player, 1)
280280
else:
281281
self.multiworld.completion_condition[self.player] = lambda state: self.kh2_has_all(three_proofs, state)
282282
# lucky emblem hunt
283-
elif self.multiworld.Goal[self.player] == "lucky_emblem_hunt":
284-
final_xemnas_location.access_rule = lambda state: state.has(ItemName.LuckyEmblem, self.player, self.multiworld.LuckyEmblemsRequired[self.player].value)
285-
if self.multiworld.FinalXemnas[self.player]:
283+
elif self.world.options.Goal == "lucky_emblem_hunt":
284+
final_xemnas_location.access_rule = lambda state: state.has(ItemName.LuckyEmblem, self.player, self.world.options.LuckyEmblemsRequired.value)
285+
if self.world.options.FinalXemnas:
286286
self.multiworld.completion_condition[self.player] = lambda state: state.has(ItemName.Victory, self.player, 1)
287287
else:
288-
self.multiworld.completion_condition[self.player] = lambda state: state.has(ItemName.LuckyEmblem, self.player, self.multiworld.LuckyEmblemsRequired[self.player].value)
288+
self.multiworld.completion_condition[self.player] = lambda state: state.has(ItemName.LuckyEmblem, self.player, self.world.options.LuckyEmblemsRequired.value)
289289
# hitlist if == 2
290-
elif self.multiworld.Goal[self.player] == "hitlist":
291-
final_xemnas_location.access_rule = lambda state: state.has(ItemName.Bounty, self.player, self.multiworld.BountyRequired[self.player].value)
292-
if self.multiworld.FinalXemnas[self.player]:
290+
elif self.world.options.Goal == "hitlist":
291+
final_xemnas_location.access_rule = lambda state: state.has(ItemName.Bounty, self.player, self.world.options.BountyRequired.value)
292+
if self.world.options.FinalXemnas:
293293
self.multiworld.completion_condition[self.player] = lambda state: state.has(ItemName.Victory, self.player, 1)
294294
else:
295-
self.multiworld.completion_condition[self.player] = lambda state: state.has(ItemName.Bounty, self.player, self.multiworld.BountyRequired[self.player].value)
295+
self.multiworld.completion_condition[self.player] = lambda state: state.has(ItemName.Bounty, self.player, self.world.options.BountyRequired.value)
296296
else:
297-
final_xemnas_location.access_rule = lambda state: state.has(ItemName.Bounty, self.player, self.multiworld.BountyRequired[self.player].value) and \
298-
state.has(ItemName.LuckyEmblem, self.player, self.multiworld.LuckyEmblemsRequired[self.player].value)
299-
if self.multiworld.FinalXemnas[self.player]:
297+
298+
final_xemnas_location.access_rule = lambda state: state.has(ItemName.Bounty, self.player, self.world.options.BountyRequired.value) and \
299+
state.has(ItemName.LuckyEmblem, self.player, self.world.options.LuckyEmblemsRequired.value)
300+
if self.world.options.FinalXemnas:
300301
self.multiworld.completion_condition[self.player] = lambda state: state.has(ItemName.Victory, self.player, 1)
301302
else:
302-
self.multiworld.completion_condition[self.player] = lambda state: state.has(ItemName.Bounty, self.player, self.multiworld.BountyRequired[self.player].value) and \
303-
state.has(ItemName.LuckyEmblem, self.player, self.multiworld.LuckyEmblemsRequired[self.player].value)
303+
self.multiworld.completion_condition[self.player] = lambda state: state.has(ItemName.Bounty, self.player, self.world.options.BountyRequired.value) and \
304+
state.has(ItemName.LuckyEmblem, self.player, self.world.options.LuckyEmblemsRequired.value)
304305

305306

306307
class KH2FormRules(KH2Rules):
@@ -409,7 +410,7 @@ class KH2FightRules(KH2Rules):
409410
# if skip rules are of return false
410411
def __init__(self, world: KH2World) -> None:
411412
super().__init__(world)
412-
self.fight_logic = self.multiworld.FightLogic[self.player].current_key
413+
self.fight_logic = world.options.FightLogic.current_key
413414

414415
self.fight_region_rules = {
415416
RegionName.ShanYu: lambda state: self.get_shan_yu_rules(state),
@@ -935,7 +936,7 @@ def get_cor_first_fight_rules(self, state: CollectionState) -> bool:
935936

936937
def get_cor_skip_first_rules(self, state: CollectionState) -> bool:
937938
# if option is not allow skips return false else run rules
938-
if not self.multiworld.CorSkipToggle[self.player]:
939+
if not self.world.options.CorSkipToggle:
939940
return False
940941
# easy: aerial dodge 3,master form,fire
941942
# normal: aerial dodge 2, master form,fire

0 commit comments

Comments
 (0)