mirror of
https://github.com/ArchipelagoMW/Archipelago.git
synced 2026-05-27 07:09:56 -07:00
Improve performance of Yacht Dice
This commit is contained in:
@@ -205,9 +205,21 @@ def dice_simulation_strings(categories, num_dice, num_rolls, fixed_mult, step_mu
|
|||||||
|
|
||||||
# Returns the feasible score that one can reach with the current state, options and difficulty.
|
# Returns the feasible score that one can reach with the current state, options and difficulty.
|
||||||
def dice_simulation(state, player, options):
|
def dice_simulation(state, player, options):
|
||||||
categories, num_dice, num_rolls, fixed_mult, step_mult, expoints = extract_progression(state, player, options)
|
if player == "state_is_a_list":
|
||||||
return dice_simulation_strings(categories, num_dice, num_rolls, fixed_mult, step_mult,
|
categories, num_dice, num_rolls, fixed_mult, step_mult, expoints = extract_progression(state, player, options)
|
||||||
options.game_difficulty.value) + expoints
|
return dice_simulation_strings(
|
||||||
|
categories, num_dice, num_rolls, fixed_mult, step_mult, options.game_difficulty.value
|
||||||
|
) + expoints
|
||||||
|
|
||||||
|
if state.prog_items[player]["state_is_fresh"] == 0:
|
||||||
|
state.prog_items[player]["state_is_fresh"] = 1
|
||||||
|
categories, num_dice, num_rolls, fixed_mult, step_mult, expoints = extract_progression(state, player, options)
|
||||||
|
state.prog_items[player]["maximum_achievable_score"] = dice_simulation_strings(
|
||||||
|
categories, num_dice, num_rolls, fixed_mult, step_mult, options.game_difficulty.value
|
||||||
|
) + expoints
|
||||||
|
|
||||||
|
return state.prog_items[player]["maximum_achievable_score"]
|
||||||
|
|
||||||
|
|
||||||
# Sets rules on entrances and advancements that are always applied
|
# Sets rules on entrances and advancements that are always applied
|
||||||
def set_yacht_rules(world: MultiWorld, player: int, options):
|
def set_yacht_rules(world: MultiWorld, player: int, options):
|
||||||
|
|||||||
@@ -396,3 +396,17 @@ class YachtDiceWorld(World):
|
|||||||
item_data = item_table[name]
|
item_data = item_table[name]
|
||||||
item = YachtDiceItem(name, item_data.classification, item_data.code, self.player)
|
item = YachtDiceItem(name, item_data.classification, item_data.code, self.player)
|
||||||
return item
|
return item
|
||||||
|
|
||||||
|
def collect(self, state, item: Item) -> bool:
|
||||||
|
change = super().collect(state, item)
|
||||||
|
if change and item.advancement:
|
||||||
|
state.prog_items[self.player]["state_is_fresh"] = 0
|
||||||
|
|
||||||
|
return change
|
||||||
|
|
||||||
|
def remove(self, state, item: Item) -> bool:
|
||||||
|
change = super().remove(state, item)
|
||||||
|
if change and item.advancement:
|
||||||
|
state.prog_items[self.player]["state_is_fresh"] = 0
|
||||||
|
|
||||||
|
return change
|
||||||
Reference in New Issue
Block a user