Skip to content

Commit

Permalink
Merge pull request #2 from gaithern/adding-journal-checks
Browse files Browse the repository at this point in the history
Adding journal checks
  • Loading branch information
gaithern authored Nov 19, 2023
2 parents 8e3ad14 + 91b4e73 commit 062cad5
Show file tree
Hide file tree
Showing 8 changed files with 673 additions and 720 deletions.
401 changes: 174 additions & 227 deletions data/lua/connector_khcom.lua

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion worlds/khcom/Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ async def game_watcher(ctx: KHCOMContext):
for file in files:
if file.find("send") > -1:
st = file.split("send", -1)[1]
sending = sending+[(int(st))]
if st != "nil":
sending = sending+[(int(st))]
if file.find("victory") > -1:
victory = True
ctx.locations_checked = sending
Expand Down
240 changes: 119 additions & 121 deletions worlds/khcom/Items.py

Large diffs are not rendered by default.

270 changes: 154 additions & 116 deletions worlds/khcom/Locations.py

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions worlds/khcom/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

from Options import Choice, Range, Option, Toggle, DeathLink, DefaultOnToggle, OptionSet

class EnemyCards(Toggle):
"""
Should progression checks be included for enemy cards?
"""
display_name = "Enemy Cards Checks Hold Progression"

class PrioritizeBosses(Toggle):
"""
Should boss location prioritize holding friend cards?
Expand All @@ -16,6 +10,5 @@ class PrioritizeBosses(Toggle):


khcom_options: Dict[str, type(Option)] = {
"enemy_cards": EnemyCards,
"prioritize_bosses": PrioritizeBosses,
}
329 changes: 156 additions & 173 deletions worlds/khcom/Regions.py

Large diffs are not rendered by default.

126 changes: 55 additions & 71 deletions worlds/khcom/Rules.py

Large diffs are not rendered by default.

17 changes: 13 additions & 4 deletions worlds/khcom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
from BaseClasses import Tutorial
from worlds.AutoWorld import WebWorld, World
from .Items import KHCOMItem, KHCOMItemData, event_item_table, get_items_by_category, item_table
from .Locations import KHCOMLocation, location_table
from .Locations import KHCOMLocation, location_table, get_locations_by_category
from .Options import khcom_options
from .Regions import create_regions
from .Rules import set_rules
from worlds.LauncherComponents import Component, components, Type, launch_subprocess
import random



Expand Down Expand Up @@ -54,15 +55,23 @@ def fill_slot_data(self) -> dict:

def create_items(self):
item_pool: List[KHCOMItem] = []
starting_locations = get_locations_by_category("Starting")
starting_locations = random.sample(list(starting_locations.keys()),3)
starting_worlds = get_items_by_category("World Unlocks")
starting_worlds = random.sample(list(starting_worlds.keys()),3)
i = 0
while i < 3:
self.multiworld.get_location(starting_locations[i], self.player).place_locked_item(self.create_item(starting_worlds[i]))
i = i + 1
total_locations = len(self.multiworld.get_unfilled_locations(self.player))
for name, data in item_table.items():
quantity = data.max_quantity

# Ignore filler, it will be added in a later stage.
if data.category == "Filler":
continue

item_pool += [self.create_item(name) for _ in range(0, quantity)]
if name not in starting_worlds:
item_pool += [self.create_item(name) for _ in range(0, quantity)]

# Fill any empty locations with filler items.
while len(item_pool) < total_locations:
Expand All @@ -74,7 +83,7 @@ def get_filler_item_name(self) -> str:
fillers = get_items_by_category("Filler")
weights = [data.weight for data in fillers.values()]
return self.multiworld.random.choices([filler for filler in fillers.keys()], weights, k=1)[0]

def create_item(self, name: str) -> KHCOMItem:
data = item_table[name]
return KHCOMItem(name, data.classification, data.code, self.player)
Expand Down

0 comments on commit 062cad5

Please sign in to comment.