Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option for MC bee traps #20

Merged
merged 3 commits into from
Jul 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion test/minecraft/TestMinecraft.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from worlds.minecraft import MinecraftWorld
from worlds.minecraft.Items import MinecraftItem, item_table
from worlds.minecraft.Options import AdvancementGoal, CombatDifficulty
from Options import Toggle

# Converts the name of an item into an item object
def MCItemFactory(items, player: int):
Expand Down Expand Up @@ -33,8 +34,9 @@ def setUp(self):
for pool in exclusion_pools:
setattr(self.world, f"include_{pool}_advancements", [False, False])
setattr(self.world, "advancement_goal", {1: AdvancementGoal(30)})
setattr(self.world, "shuffle_structures", {1: False})
setattr(self.world, "shuffle_structures", {1: Toggle(False)})
setattr(self.world, "combat_difficulty", {1: CombatDifficulty(1)}) # normal
setattr(self.world, "bee_traps", {1: Toggle(False)})
AutoWorld.call_single(self.world, "create_regions", 1)
AutoWorld.call_single(self.world, "generate_basic", 1)
AutoWorld.call_single(self.world, "set_rules", 1)
Expand Down
4 changes: 2 additions & 2 deletions worlds/minecraft/Items.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ def __init__(self, name: str, progression: bool, code: int, player: int):
"4 Lapis Lazuli": 2,
"16 Porkchops": 8,
"8 Gold Ore": 4,
"Rotten Flesh": 2,
"Rotten Flesh": 4,
"Single Arrow": 0,
"Bee Trap (Minecraft)": 2
"Bee Trap (Minecraft)": 0
}

lookup_id_to_name: typing.Dict[int, str] = {data.code: item_name for item_name, data in item_table.items() if data.code}
3 changes: 2 additions & 1 deletion worlds/minecraft/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ class CombatDifficulty(Choice):
"include_hard_advancements": Toggle,
"include_insane_advancements": Toggle,
"include_postgame_advancements": Toggle,
"shuffle_structures": Toggle
"shuffle_structures": Toggle,
"bee_traps": Toggle
}
5 changes: 4 additions & 1 deletion worlds/minecraft/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ def generate_basic(self):
link_minecraft_structures(self.world, self.player)

pool = []
pool_counts = item_frequencies.copy()
if getattr(self.world, "bee_traps")[self.player]:
pool_counts.update({"Rotten Flesh": 0, "Bee Trap (Minecraft)": 4})
for item_name, item_data in item_table.items():
for count in range(item_frequencies.get(item_name, 1)):
for count in range(pool_counts.get(item_name, 1)):
pool.append(MinecraftItem(item_name, item_data.progression, item_data.code, self.player))

prefill_pool = {}
Expand Down