Minecraft: refactored bee trap to percentage of junk item pool
This commit is contained in:
parent
306bdd322f
commit
72de0450e0
|
@ -98,33 +98,4 @@ junk_weights = {
|
|||
"32 Arrows": 1,
|
||||
}
|
||||
|
||||
# If not listed here then has frequency 1
|
||||
item_frequencies = {
|
||||
"Progressive Weapons": 3,
|
||||
"Progressive Tools": 3,
|
||||
"Progressive Armor": 2,
|
||||
"8 Netherite Scrap": 2,
|
||||
"8 Emeralds": 0,
|
||||
"4 Emeralds": 8,
|
||||
"4 Diamond Ore": 4,
|
||||
"16 Iron Ore": 4,
|
||||
"500 XP": 0,
|
||||
"100 XP": 0,
|
||||
"50 XP": 21,
|
||||
"3 Ender Pearls": 4,
|
||||
"4 Lapis Lazuli": 2,
|
||||
"16 Porkchops": 8,
|
||||
"8 Gold Ore": 4,
|
||||
"Rotten Flesh": 4,
|
||||
"Single Arrow": 0,
|
||||
"32 Arrows": 4,
|
||||
"Structure Compass (Village)": 0,
|
||||
"Structure Compass (Pillager Outpost)": 0,
|
||||
"Structure Compass (Nether Fortress)": 0,
|
||||
"Structure Compass (Bastion Remnant)": 0,
|
||||
"Structure Compass (End City)": 0,
|
||||
"Shulker Box": 0,
|
||||
"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}
|
||||
|
|
|
@ -15,6 +15,11 @@ class CombatDifficulty(Choice):
|
|||
default = 1
|
||||
|
||||
|
||||
class BeeTraps(Range):
|
||||
range_start = 0
|
||||
range_end = 100
|
||||
|
||||
|
||||
minecraft_options: typing.Dict[str, type(Option)] = {
|
||||
"advancement_goal": AdvancementGoal,
|
||||
"combat_difficulty": CombatDifficulty,
|
||||
|
@ -23,5 +28,5 @@ minecraft_options: typing.Dict[str, type(Option)] = {
|
|||
"include_postgame_advancements": Toggle,
|
||||
"shuffle_structures": Toggle,
|
||||
"structure_compasses": Toggle,
|
||||
"bee_traps": Toggle
|
||||
"bee_traps": BeeTraps
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
import os
|
||||
|
||||
from math import ceil
|
||||
|
||||
from .Items import MinecraftItem, item_table, required_items, junk_weights
|
||||
from .Locations import MinecraftAdvancement, advancement_table, exclusion_table, events_table
|
||||
|
@ -40,6 +40,7 @@ class MinecraftWorld(World):
|
|||
|
||||
# Generate item pool
|
||||
itempool = []
|
||||
junk_pool = junk_weights.copy()
|
||||
# Add all required progression items
|
||||
for (name, num) in required_items.items():
|
||||
itempool += [name] * num
|
||||
|
@ -49,10 +50,10 @@ class MinecraftWorld(World):
|
|||
for struct_name in structures:
|
||||
itempool.append(f"Structure Compass ({struct_name})")
|
||||
# Add bee traps if desired
|
||||
if self.world.bee_traps[self.player]:
|
||||
itempool += ["Bee Trap (Minecraft)"] * 4
|
||||
bee_trap_quantity = ceil(self.world.bee_traps[self.player] * (len(self.location_names)-len(itempool)) * 0.01)
|
||||
itempool += ["Bee Trap (Minecraft)"] * bee_trap_quantity
|
||||
# Fill remaining items with randomly generated junk
|
||||
itempool += self.world.random.choices(list(junk_weights.keys()), weights=list(junk_weights.values()), k=len(self.location_names)-len(itempool))
|
||||
itempool += self.world.random.choices(list(junk_pool.keys()), weights=list(junk_pool.values()), k=len(self.location_names)-len(itempool))
|
||||
# Convert itempool into real items
|
||||
itempool = [item for item in map(lambda name: self.create_item(name), itempool)]
|
||||
|
||||
|
|
Loading…
Reference in New Issue