Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
gaithern authored Aug 20, 2024
2 parents 8339a09 + 0e6e359 commit b964a40
Show file tree
Hide file tree
Showing 47 changed files with 5,199 additions and 461 deletions.
1 change: 1 addition & 0 deletions NetUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class NetworkItem(typing.NamedTuple):
item: int
location: int
player: int
""" Sending player, except in LocationInfo (from LocationScouts), where it is the receiving player. """
flags: int = 0


Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Currently, the following games are supported:
* A Hat in Time
* Old School Runescape
* Kingdom Hearts 1
* Mega Man 2
* Kingdom Hearts RE: Chain of Memories

For setup and instructions check out our [tutorials page](https://archipelago.gg/tutorial/).
Expand Down
3 changes: 3 additions & 0 deletions docs/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@
# Minecraft
/worlds/minecraft/ @KonoTyran @espeon65536

# Mega Man 2
/worlds/mm2/ @Silvris

# MegaMan Battle Network 3
/worlds/mmbn3/ @digiholic

Expand Down
5 changes: 5 additions & 0 deletions inno_setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ Root: HKCR; Subkey: "{#MyAppName}cv64patch"; ValueData: "Arc
Root: HKCR; Subkey: "{#MyAppName}cv64patch\DefaultIcon"; ValueData: "{app}\ArchipelagoBizHawkClient.exe,0"; ValueType: string; ValueName: "";
Root: HKCR; Subkey: "{#MyAppName}cv64patch\shell\open\command"; ValueData: """{app}\ArchipelagoBizHawkClient.exe"" ""%1"""; ValueType: string; ValueName: "";

Root: HKCR; Subkey: ".apmm2"; ValueData: "{#MyAppName}mm2patch"; Flags: uninsdeletevalue; ValueType: string; ValueName: "";
Root: HKCR; Subkey: "{#MyAppName}mm2patch"; ValueData: "Archipelago Mega Man 2 Patch"; Flags: uninsdeletekey; ValueType: string; ValueName: "";
Root: HKCR; Subkey: "{#MyAppName}mm2patch\DefaultIcon"; ValueData: "{app}\ArchipelagoBizHawkClient.exe,0"; ValueType: string; ValueName: "";
Root: HKCR; Subkey: "{#MyAppName}mm2patch\shell\open\command"; ValueData: """{app}\ArchipelagoBizHawkClient.exe"" ""%1"""; ValueType: string; ValueName: "";

Root: HKCR; Subkey: ".apladx"; ValueData: "{#MyAppName}ladxpatch"; Flags: uninsdeletevalue; ValueType: string; ValueName: "";
Root: HKCR; Subkey: "{#MyAppName}ladxpatch"; ValueData: "Archipelago Links Awakening DX Patch"; Flags: uninsdeletekey; ValueType: string; ValueName: "";
Root: HKCR; Subkey: "{#MyAppName}ladxpatch\DefaultIcon"; ValueData: "{app}\ArchipelagoLinksAwakeningClient.exe,0"; ValueType: string; ValueName: "";
Expand Down
37 changes: 20 additions & 17 deletions worlds/minecraft/ItemPool.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
from math import ceil
from typing import List

from BaseClasses import MultiWorld, Item
from worlds.AutoWorld import World
from BaseClasses import Item

from . import Constants
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from . import MinecraftWorld


def get_junk_item_names(rand, k: int) -> str:
junk_weights = Constants.item_info["junk_weights"]
Expand All @@ -14,39 +18,38 @@ def get_junk_item_names(rand, k: int) -> str:
k=k)
return junk

def build_item_pool(mc_world: World) -> List[Item]:
multiworld = mc_world.multiworld
player = mc_world.player
def build_item_pool(world: "MinecraftWorld") -> List[Item]:
multiworld = world.multiworld
player = world.player

itempool = []
total_location_count = len(multiworld.get_unfilled_locations(player))

required_pool = Constants.item_info["required_pool"]
junk_weights = Constants.item_info["junk_weights"]

# Add required progression items
for item_name, num in required_pool.items():
itempool += [mc_world.create_item(item_name) for _ in range(num)]
itempool += [world.create_item(item_name) for _ in range(num)]

# Add structure compasses
if multiworld.structure_compasses[player]:
compasses = [name for name in mc_world.item_name_to_id if "Structure Compass" in name]
if world.options.structure_compasses:
compasses = [name for name in world.item_name_to_id if "Structure Compass" in name]
for item_name in compasses:
itempool.append(mc_world.create_item(item_name))
itempool.append(world.create_item(item_name))

# Dragon egg shards
if multiworld.egg_shards_required[player] > 0:
num = multiworld.egg_shards_available[player]
itempool += [mc_world.create_item("Dragon Egg Shard") for _ in range(num)]
if world.options.egg_shards_required > 0:
num = world.options.egg_shards_available
itempool += [world.create_item("Dragon Egg Shard") for _ in range(num)]

# Bee traps
bee_trap_percentage = multiworld.bee_traps[player] * 0.01
bee_trap_percentage = world.options.bee_traps * 0.01
if bee_trap_percentage > 0:
bee_trap_qty = ceil(bee_trap_percentage * (total_location_count - len(itempool)))
itempool += [mc_world.create_item("Bee Trap") for _ in range(bee_trap_qty)]
itempool += [world.create_item("Bee Trap") for _ in range(bee_trap_qty)]

# Fill remaining itempool with randomly generated junk
junk = get_junk_item_names(multiworld.random, total_location_count - len(itempool))
itempool += [mc_world.create_item(name) for name in junk]
junk = get_junk_item_names(world.random, total_location_count - len(itempool))
itempool += [world.create_item(name) for name in junk]

return itempool
59 changes: 36 additions & 23 deletions worlds/minecraft/Options.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import typing
from Options import Choice, Option, Toggle, DefaultOnToggle, Range, OptionList, DeathLink, PlandoConnections
from Options import Choice, Toggle, DefaultOnToggle, Range, OptionList, DeathLink, PlandoConnections, \
PerGameCommonOptions
from .Constants import region_info
from dataclasses import dataclass


class AdvancementGoal(Range):
Expand Down Expand Up @@ -55,7 +56,7 @@ class StructureCompasses(DefaultOnToggle):
display_name = "Structure Compasses"


class BeeTraps(Range):
class BeeTraps(Range):
"""Replaces a percentage of junk items with bee traps, which spawn multiple angered bees around every player when
received."""
display_name = "Bee Trap Percentage"
Expand Down Expand Up @@ -94,7 +95,20 @@ class SendDefeatedMobs(Toggle):


class StartingItems(OptionList):
"""Start with these items. Each entry should be of this format: {item: "item_name", amount: #, nbt: "nbt_string"}"""
"""Start with these items. Each entry should be of this format: {item: "item_name", amount: #}
`item` can include components, and should be in an identical format to a `/give` command with
`"` escaped for json reasons.
`amount` is optional and will default to 1 if omitted.
example:
```
starting_items: [
{ "item": "minecraft:stick[minecraft:custom_name=\"{'text':'pointy stick'}\"]" },
{ "item": "minecraft:arrow[minecraft:rarity=epic]", amount: 64 }
]
```
"""
display_name = "Starting Items"


Expand All @@ -109,22 +123,21 @@ def can_connect(cls, entrance, exit):
return True


minecraft_options: typing.Dict[str, type(Option)] = {
"plando_connections": MCPlandoConnections,
"advancement_goal": AdvancementGoal,
"egg_shards_required": EggShardsRequired,
"egg_shards_available": EggShardsAvailable,
"required_bosses": BossGoal,

"shuffle_structures": ShuffleStructures,
"structure_compasses": StructureCompasses,

"combat_difficulty": CombatDifficulty,
"include_hard_advancements": HardAdvancements,
"include_unreasonable_advancements": UnreasonableAdvancements,
"include_postgame_advancements": PostgameAdvancements,
"bee_traps": BeeTraps,
"send_defeated_mobs": SendDefeatedMobs,
"death_link": DeathLink,
"starting_items": StartingItems,
}
@dataclass
class MinecraftOptions(PerGameCommonOptions):
plando_connections: MCPlandoConnections
advancement_goal: AdvancementGoal
egg_shards_required: EggShardsRequired
egg_shards_available: EggShardsAvailable
required_bosses: BossGoal
shuffle_structures: ShuffleStructures
structure_compasses: StructureCompasses

combat_difficulty: CombatDifficulty
include_hard_advancements: HardAdvancements
include_unreasonable_advancements: UnreasonableAdvancements
include_postgame_advancements: PostgameAdvancements
bee_traps: BeeTraps
send_defeated_mobs: SendDefeatedMobs
death_link: DeathLink
starting_items: StartingItems
Loading

0 comments on commit b964a40

Please sign in to comment.