mirror of
https://github.com/ArchipelagoMW/Archipelago.git
synced 2026-04-10 07:58:15 -07:00
Mostly minimize_extra_items improvements
- Change logic, generation is now even faster (0.6s per default yaml). - Made the option 'minimize_extra_items' do a lot more, hopefully this makes the impact of Yacht Dice a little bit less, if you want that. Here's what is also does now: - you start with 2 dice and 2 rolls - there will be less locations/items at the start of you game
This commit is contained in:
@@ -28,7 +28,7 @@ def all_locations_fun(max_score):
|
||||
return {f"{i} score": LocData(starting_index + i, "Board", i) for i in range(1, max_score + 1)}
|
||||
|
||||
|
||||
def ini_locations(goal_score, max_score, number_of_locations, dif):
|
||||
def ini_locations(goal_score, max_score, number_of_locations, dif, skip_early_locations, number_of_players):
|
||||
"""
|
||||
function that loads in all locations necessary for the game, so based on options.
|
||||
will make sure that goal_score and max_score are included locations
|
||||
@@ -47,9 +47,16 @@ def ini_locations(goal_score, max_score, number_of_locations, dif):
|
||||
# and the next score will always be at least highest_score + 1
|
||||
# note that current_score is at most max_score-1
|
||||
highest_score = 0
|
||||
start_score = 0
|
||||
|
||||
if skip_early_locations:
|
||||
scaling = 1.95
|
||||
if number_of_players > 2:
|
||||
scaling = max(1.2, 2.2 - number_of_players * 0.1)
|
||||
|
||||
for i in range(number_of_locations - 1):
|
||||
percentage = i / number_of_locations
|
||||
current_score = int(1 + (percentage**scaling) * (max_score - 2))
|
||||
current_score = int(start_score + 1 + (percentage**scaling) * (max_score - start_score - 2))
|
||||
if current_score <= highest_score:
|
||||
current_score = highest_score + 1
|
||||
highest_score = current_score
|
||||
|
||||
@@ -195,9 +195,11 @@ class PointsSize(Choice):
|
||||
class MinimizeExtraItems(Choice):
|
||||
"""
|
||||
Besides necessary items, Yacht Dice has extra useful/filler items in the item pool.
|
||||
It is possible however to decrease the number of extra items in multiplayer games.
|
||||
Do you want to reduce the number of extra items?
|
||||
(this option only does something in multiplayer games)
|
||||
It is possible however to decrease the number of locations and extra items.
|
||||
This option will:
|
||||
- decrease the number of locations at the start (you'll start with 2 dice and 2 rolls).
|
||||
- will limit the number of dice/roll fragments per dice/roll to 2.
|
||||
- in multiplayer games, it will reduce the number of filler items.
|
||||
"""
|
||||
|
||||
display_name = "Minimize extra items"
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -56,7 +56,7 @@ class YachtDiceWorld(World):
|
||||
|
||||
item_name_groups = item_groups
|
||||
|
||||
ap_world_version = "2.1.0"
|
||||
ap_world_version = "2.1.1"
|
||||
|
||||
def _get_yachtdice_data(self):
|
||||
return {
|
||||
@@ -68,6 +68,7 @@ class YachtDiceWorld(World):
|
||||
}
|
||||
|
||||
def generate_early(self):
|
||||
print(self.options)
|
||||
"""
|
||||
In generate early, we fill the item-pool, then determine the number of locations, and add filler items.
|
||||
"""
|
||||
@@ -95,9 +96,14 @@ class YachtDiceWorld(World):
|
||||
else:
|
||||
raise Exception(f"[Yacht Dice] Unknown MinimalNumberOfDiceAndRolls options {opt_dice_and_rolls}")
|
||||
|
||||
|
||||
# amount of dice and roll fragments needed to get a dice or roll
|
||||
self.frags_per_dice = self.options.number_of_dice_fragments_per_dice.value
|
||||
self.frags_per_roll = self.options.number_of_roll_fragments_per_roll.value
|
||||
|
||||
if self.options.minimize_extra_items == MinimizeExtraItems.option_yes_please:
|
||||
self.frags_per_dice = min(self.frags_per_dice, 2)
|
||||
self.frags_per_roll = min(self.frags_per_roll, 2)
|
||||
|
||||
# set difficulty
|
||||
diff_value = self.options.game_difficulty
|
||||
@@ -154,22 +160,41 @@ class YachtDiceWorld(World):
|
||||
self.itempool.append(cats[categorylist[index]])
|
||||
|
||||
# Also start with one Roll and one Dice
|
||||
self.precollected.append("Roll")
|
||||
self.precollected.append("Dice")
|
||||
num_of_dice_to_add = num_of_dice - 1
|
||||
self.precollected.append("Roll")
|
||||
num_of_rolls_to_add = num_of_rolls - 1
|
||||
|
||||
self.skip_early_locations = False
|
||||
if self.options.minimize_extra_items == MinimizeExtraItems.option_yes_please:
|
||||
self.precollected.append("Dice")
|
||||
num_of_dice_to_add -= 1
|
||||
self.precollected.append("Roll")
|
||||
num_of_rolls_to_add -= 1
|
||||
self.skip_early_locations = True
|
||||
|
||||
if num_of_dice_to_add > 0:
|
||||
self.itempool.append("Dice")
|
||||
num_of_dice_to_add -= 1
|
||||
if num_of_rolls_to_add > 0:
|
||||
self.itempool.append("Roll")
|
||||
num_of_rolls_to_add -= 1
|
||||
|
||||
|
||||
# if one fragment per dice, just add "Dice" objects
|
||||
if self.frags_per_dice == 1:
|
||||
self.itempool += ["Dice"] * (num_of_dice - 1) # minus one because one is in start inventory
|
||||
else:
|
||||
self.itempool.append("Dice") # always add a full dice to make generation easier (will be early)
|
||||
self.itempool += ["Dice Fragment"] * (self.frags_per_dice * (num_of_dice - 2))
|
||||
if num_of_dice_to_add > 0:
|
||||
if self.frags_per_dice == 1:
|
||||
self.itempool += ["Dice"] * num_of_dice_to_add # minus one because one is in start inventory
|
||||
else:
|
||||
self.itempool += ["Dice Fragment"] * (self.frags_per_dice * num_of_dice_to_add)
|
||||
|
||||
# if one fragment per roll, just add "Roll" objects
|
||||
if self.frags_per_roll == 1:
|
||||
self.itempool += ["Roll"] * (num_of_rolls - 1) # minus one because one is in start inventory
|
||||
else:
|
||||
self.itempool.append("Roll") # always add a full roll to make generation easier (will be early)
|
||||
self.itempool += ["Roll Fragment"] * (self.frags_per_roll * (num_of_rolls - 2))
|
||||
if num_of_rolls_to_add > 0:
|
||||
if self.frags_per_roll == 1:
|
||||
self.itempool += ["Roll"] * num_of_rolls_to_add # minus one because one is in start inventory
|
||||
else:
|
||||
self.itempool.append("Roll") # always add a full roll to make generation easier (will be early)
|
||||
self.itempool += ["Roll Fragment"] * (self.frags_per_roll * num_of_rolls_to_add)
|
||||
|
||||
already_items = len(self.itempool)
|
||||
|
||||
@@ -178,7 +203,7 @@ class YachtDiceWorld(World):
|
||||
if self.options.minimize_extra_items == MinimizeExtraItems.option_yes_please:
|
||||
extra_percentage = max(0.1, 0.8 - self.multiworld.players / 10)
|
||||
elif self.options.minimize_extra_items == MinimizeExtraItems.option_no_dont:
|
||||
extra_percentage = 0.7
|
||||
extra_percentage = 0.72
|
||||
else:
|
||||
raise Exception(f"[Yacht Dice] Unknown MinimizeExtraItems options {self.options.minimize_extra_items}")
|
||||
extra_locations_needed = max(10, math.ceil(already_items * extra_percentage))
|
||||
@@ -422,7 +447,7 @@ class YachtDiceWorld(World):
|
||||
|
||||
def create_regions(self):
|
||||
# call the ini_locations function, that generates locations based on the inputs.
|
||||
location_table = ini_locations(self.goal_score, self.max_score, self.number_of_locations, self.difficulty)
|
||||
location_table = ini_locations(self.goal_score, self.max_score, self.number_of_locations, self.difficulty, self.skip_early_locations, self.multiworld.players)
|
||||
|
||||
# simple menu-board construction
|
||||
menu = Region("Menu", self.player, self.multiworld)
|
||||
@@ -475,6 +500,8 @@ class YachtDiceWorld(World):
|
||||
"allow_manual_input",
|
||||
)
|
||||
slot_data = {**yacht_dice_data, **yacht_dice_options} # combine the two
|
||||
slot_data["number_of_dice_fragments_per_dice"] = self.frags_per_dice
|
||||
slot_data["number_of_roll_fragments_per_roll"] = self.frags_per_roll
|
||||
slot_data["goal_score"] = self.goal_score
|
||||
slot_data["last_check_score"] = self.max_score
|
||||
slot_data["allowed_categories"] = self.possible_categories
|
||||
|
||||
Reference in New Issue
Block a user