Added a custom dynamic item weights pool option.
This commit is contained in:
parent
694f942c06
commit
8d05aa6262
|
@ -1,5 +1,5 @@
|
||||||
import typing
|
import typing
|
||||||
from Options import Option, Toggle, Range
|
from Options import Option, DefaultOnToggle, Range, OptionList
|
||||||
|
|
||||||
|
|
||||||
class TotalLocations(Range):
|
class TotalLocations(Range):
|
||||||
|
@ -27,21 +27,121 @@ class ItemPickupStep(Range):
|
||||||
range_end = 5
|
range_end = 5
|
||||||
default = 1
|
default = 1
|
||||||
|
|
||||||
class AllowLunarItems(Toggle):
|
|
||||||
|
class AllowLunarItems(DefaultOnToggle):
|
||||||
"""Allows Lunar items in the item pool."""
|
"""Allows Lunar items in the item pool."""
|
||||||
displayname = "Enable Lunar Item Shuffling"
|
displayname = "Enable Lunar Item Shuffling"
|
||||||
default = True
|
|
||||||
|
|
||||||
class StartWithRevive(Toggle):
|
|
||||||
|
class StartWithRevive(DefaultOnToggle):
|
||||||
"""Start the game with a `Dio's Best Friend` item."""
|
"""Start the game with a `Dio's Best Friend` item."""
|
||||||
displayname = "Start with a Revive"
|
displayname = "Start with a Revive"
|
||||||
default = True
|
|
||||||
|
|
||||||
|
|
||||||
|
class GreenScrap(Range):
|
||||||
|
"""Weight of Green Scraps in the item pool."""
|
||||||
|
displayname = "Green Scraps"
|
||||||
|
range_start = 0
|
||||||
|
range_end = 100
|
||||||
|
default = 15
|
||||||
|
|
||||||
|
|
||||||
|
class RedScrap(Range):
|
||||||
|
"""Weight of Red Scraps in the item pool."""
|
||||||
|
displayname = "Red Scraps"
|
||||||
|
range_start = 0
|
||||||
|
range_end = 100
|
||||||
|
default = 5
|
||||||
|
|
||||||
|
|
||||||
|
class YellowScrap(Range):
|
||||||
|
"""Weight of yellow scraps in the item pool."""
|
||||||
|
displayname = "Yellow Scraps"
|
||||||
|
range_start = 0
|
||||||
|
range_end = 100
|
||||||
|
default = 1
|
||||||
|
|
||||||
|
|
||||||
|
class WhiteScrap(Range):
|
||||||
|
"""Weight of white scraps in the item pool."""
|
||||||
|
displayname = "White Scraps"
|
||||||
|
range_start = 0
|
||||||
|
range_end = 100
|
||||||
|
default = 30
|
||||||
|
|
||||||
|
|
||||||
|
class CommonItem(Range):
|
||||||
|
"""Weight of common items in the item pool."""
|
||||||
|
displayname = "Common Items"
|
||||||
|
range_start = 0
|
||||||
|
range_end = 100
|
||||||
|
default = 75
|
||||||
|
|
||||||
|
|
||||||
|
class UncommonItem(Range):
|
||||||
|
"""Weight of uncommon items in the item pool."""
|
||||||
|
displayname = "Uncommon Items"
|
||||||
|
range_start = 0
|
||||||
|
range_end = 100
|
||||||
|
default = 40
|
||||||
|
|
||||||
|
|
||||||
|
class LegendaryItem(Range):
|
||||||
|
"""Weight of legendary items in the item pool."""
|
||||||
|
displayname = "Legendary Items"
|
||||||
|
range_start = 0
|
||||||
|
range_end = 100
|
||||||
|
default = 10
|
||||||
|
|
||||||
|
|
||||||
|
class BossItem(Range):
|
||||||
|
"""Weight of boss items in the item pool."""
|
||||||
|
displayname = "Boss Items"
|
||||||
|
range_start = 0
|
||||||
|
range_end = 100
|
||||||
|
default = 5
|
||||||
|
|
||||||
|
|
||||||
|
class LunarItem(Range):
|
||||||
|
"""Weight of lunar items in the item pool."""
|
||||||
|
displayname = "Lunar Items"
|
||||||
|
range_start = 0
|
||||||
|
range_end = 100
|
||||||
|
default = 15
|
||||||
|
|
||||||
|
|
||||||
|
class Equipment(Range):
|
||||||
|
"""Weight of equipment items in the item pool."""
|
||||||
|
displayname = "Equipment"
|
||||||
|
range_start = 0
|
||||||
|
range_end = 100
|
||||||
|
default = 25
|
||||||
|
|
||||||
|
|
||||||
|
class WeightPresets(Choice):
|
||||||
|
"""Preset item weight options."""
|
||||||
|
displayname = "Item Weight Preset"
|
||||||
|
option_default = 0
|
||||||
|
|
||||||
|
|
||||||
|
ror2_weights: typing.Dict[str, type(Option)] = {
|
||||||
|
"green_scrap": GreenScrap,
|
||||||
|
"red_scrap": RedScrap,
|
||||||
|
"yellow_scrap": YellowScrap,
|
||||||
|
"white_scrap": WhiteScrap,
|
||||||
|
"common_item": CommonItem,
|
||||||
|
"uncommon_item": UncommonItem,
|
||||||
|
"legendary_item": LegendaryItem,
|
||||||
|
"boss_item": BossItem,
|
||||||
|
"lunar_item": LunarItem,
|
||||||
|
"equipment": Equipment
|
||||||
|
}
|
||||||
|
|
||||||
ror2_options: typing.Dict[str, type(Option)] = {
|
ror2_options: typing.Dict[str, type(Option)] = {
|
||||||
"total_locations": TotalLocations,
|
"total_locations": TotalLocations,
|
||||||
"total_revivals": TotalRevivals,
|
"total_revivals": TotalRevivals,
|
||||||
"start_with_revive": StartWithRevive,
|
"start_with_revive": StartWithRevive,
|
||||||
"item_pickup_step": ItemPickupStep,
|
"item_pickup_step": ItemPickupStep,
|
||||||
"enable_lunar": AllowLunarItems
|
"enable_lunar": AllowLunarItems,
|
||||||
|
**ror2_weights
|
||||||
}
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
import string
|
import string
|
||||||
from .Items import RiskOfRainItem, item_table, junk_weights
|
from .Items import RiskOfRain2Item, item_table, junk_weights
|
||||||
from .Locations import location_table, RiskOfRainLocation, base_location_table
|
from .Locations import location_table, RiskOfRainLocation, base_location_table
|
||||||
from .Rules import set_rules
|
from .Rules import set_rules
|
||||||
|
|
||||||
from BaseClasses import Region, Entrance, Item, MultiWorld
|
from BaseClasses import Region, Entrance, Item, MultiWorld
|
||||||
from .Options import ror2_options
|
from .Options import ror2_options, ror2_weights
|
||||||
from ..AutoWorld import World
|
from ..AutoWorld import World
|
||||||
|
|
||||||
client_version = 1
|
client_version = 1
|
||||||
|
@ -31,9 +31,22 @@ class RiskOfRainWorld(World):
|
||||||
if self.world.start_with_revive[self.player].value:
|
if self.world.start_with_revive[self.player].value:
|
||||||
self.world.push_precollected(self.world.create_item("Dio's Best Friend", self.player))
|
self.world.push_precollected(self.world.create_item("Dio's Best Friend", self.player))
|
||||||
|
|
||||||
|
junk_pool ={
|
||||||
|
"Item Scrap, Green": self.world.green_scrap[self.player].value,
|
||||||
|
"Item Scrap, Red": self.world.red_scrap[self.player].value,
|
||||||
|
"Item Scrap, Yellow": self.world.yellow_scrap[self.player].value,
|
||||||
|
"Item Scrap, White": self.world.white_scrap[self.player].value,
|
||||||
|
"Common Item": self.world.common_item[self.player].value,
|
||||||
|
"Uncommon Item": self.world.uncommon_item[self.player].value,
|
||||||
|
"Legendary Item": self.world.legendary_item[self.player].value,
|
||||||
|
"Boss Item": self.world.boss_item[self.player].value,
|
||||||
|
"Lunar Item": self.world.lunar_item[self.player].value,
|
||||||
|
"Equipment": self.world.equipment[self.player].value
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Generate item pool
|
# Generate item pool
|
||||||
itempool = []
|
itempool = []
|
||||||
junk_pool = junk_weights.copy()
|
|
||||||
|
|
||||||
# Add revive items for the player
|
# Add revive items for the player
|
||||||
itempool += ["Dio's Best Friend"] * self.world.total_revivals[self.player]
|
itempool += ["Dio's Best Friend"] * self.world.total_revivals[self.player]
|
||||||
|
@ -41,6 +54,7 @@ class RiskOfRainWorld(World):
|
||||||
if not self.world.enable_lunar[self.player]:
|
if not self.world.enable_lunar[self.player]:
|
||||||
junk_pool.pop("Lunar Item")
|
junk_pool.pop("Lunar Item")
|
||||||
|
|
||||||
|
|
||||||
# Fill remaining items with randomly generated junk
|
# Fill remaining items with randomly generated junk
|
||||||
itempool += self.world.random.choices(list(junk_pool.keys()), weights=list(junk_pool.values()),
|
itempool += self.world.random.choices(list(junk_pool.keys()), weights=list(junk_pool.values()),
|
||||||
k=self.world.total_locations[self.player] -
|
k=self.world.total_locations[self.player] -
|
||||||
|
@ -68,7 +82,7 @@ class RiskOfRainWorld(World):
|
||||||
|
|
||||||
def create_item(self, name: str) -> Item:
|
def create_item(self, name: str) -> Item:
|
||||||
item_id = item_table[name]
|
item_id = item_table[name]
|
||||||
item = RiskOfRainItem(name, True, item_id, self.player)
|
item = RiskOfRain2Item(name, True, item_id, self.player)
|
||||||
return item
|
return item
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,12 +95,12 @@ def create_regions(world, player: int):
|
||||||
]
|
]
|
||||||
|
|
||||||
world.get_entrance("Lobby", player).connect(world.get_region("Petrichor V", player))
|
world.get_entrance("Lobby", player).connect(world.get_region("Petrichor V", player))
|
||||||
world.get_location("Level One", player).place_locked_item(RiskOfRainItem("Beat Level One", True, None, player))
|
world.get_location("Level One", player).place_locked_item(RiskOfRain2Item("Beat Level One", True, None, player))
|
||||||
world.get_location("Level Two", player).place_locked_item(RiskOfRainItem("Beat Level Two", True, None, player))
|
world.get_location("Level Two", player).place_locked_item(RiskOfRain2Item("Beat Level Two", True, None, player))
|
||||||
world.get_location("Level Three", player).place_locked_item(RiskOfRainItem("Beat Level Three", True, None, player))
|
world.get_location("Level Three", player).place_locked_item(RiskOfRain2Item("Beat Level Three", True, None, player))
|
||||||
world.get_location("Level Four", player).place_locked_item(RiskOfRainItem("Beat Level Four", True, None, player))
|
world.get_location("Level Four", player).place_locked_item(RiskOfRain2Item("Beat Level Four", True, None, player))
|
||||||
world.get_location("Level Five", player).place_locked_item(RiskOfRainItem("Beat Level Five", True, None, player))
|
world.get_location("Level Five", player).place_locked_item(RiskOfRain2Item("Beat Level Five", True, None, player))
|
||||||
world.get_location("Victory", player).place_locked_item(RiskOfRainItem("Victory", True, None, player))
|
world.get_location("Victory", player).place_locked_item(RiskOfRain2Item("Victory", True, None, player))
|
||||||
|
|
||||||
|
|
||||||
def create_region(world: MultiWorld, player: int, name: str, locations=None, exits=None):
|
def create_region(world: MultiWorld, player: int, name: str, locations=None, exits=None):
|
||||||
|
|
Loading…
Reference in New Issue