mirror of
https://github.com/ArchipelagoMW/Archipelago.git
synced 2026-03-23 17:53:22 -07:00
Changed logic, tweaked a bit too
This commit is contained in:
@@ -182,14 +182,14 @@ class minimizeExtraItems(Choice):
|
||||
class addExtraPoints(Choice):
|
||||
"""
|
||||
Yacht Dice typically has space for extra items.
|
||||
If there is space, would you like extra points shuffled in the item pool?
|
||||
If there is space, would you like bonus points shuffled in the item pool?
|
||||
They make the game a little bit easier, as they are not considered in the logic.
|
||||
|
||||
all_of_it: fill all locations with extra points
|
||||
sure: put some extra points in
|
||||
never: don't put any extra points
|
||||
sure: put some bonus points in
|
||||
never: don't put any bonus points
|
||||
"""
|
||||
display_name = "Extra points in the pool"
|
||||
display_name = "Extra bonus in the pool"
|
||||
option_all_of_it = 1
|
||||
option_sure = 2
|
||||
option_never = 3
|
||||
@@ -251,6 +251,6 @@ class YachtDiceOptions(PerGameCommonOptions):
|
||||
points_size: pointsSize
|
||||
|
||||
minimize_extra_items: minimizeExtraItems
|
||||
add_extra_points: addExtraPoints
|
||||
add_bonus_points: addExtraPoints
|
||||
add_story_chapters: addStoryChapters
|
||||
which_story: whichStory
|
||||
@@ -2,7 +2,6 @@ from ..generic.Rules import set_rule
|
||||
from BaseClasses import MultiWorld
|
||||
from .YachtWeights import yacht_weights
|
||||
import math
|
||||
from collections import defaultdict
|
||||
|
||||
category_mappings = {
|
||||
"Category Ones": "Ones",
|
||||
@@ -128,14 +127,16 @@ def diceSimulationStrings(categories, nbDice, nbRolls, fixed_mult, step_mult, di
|
||||
#sort categories because for the step multiplier, you will want low-scorig categories first
|
||||
categories.sort(key=lambda category: category.meanScore(nbDice, nbRolls))
|
||||
|
||||
|
||||
|
||||
#function to add two discrete distribution.
|
||||
def add_distributions(dist1, dist2):
|
||||
combined_dist = defaultdict(float)
|
||||
combined_dist = {}
|
||||
for val1, prob1 in dist1.items():
|
||||
for val2, prob2 in dist2.items():
|
||||
combined_dist[int(val1 + val2)] += prob1 * prob2
|
||||
return dict(combined_dist)
|
||||
if int(val1 + val2) in combined_dist.keys():
|
||||
combined_dist[int(val1 + val2)] += prob1 * prob2
|
||||
else:
|
||||
combined_dist[int(val1 + val2)] = prob1 * prob2
|
||||
return combined_dist
|
||||
|
||||
#function to take the maximum of 'times' i.i.d. dist1.
|
||||
def max_dist(dist1, mults):
|
||||
@@ -145,7 +146,7 @@ def diceSimulationStrings(categories, nbDice, nbRolls, fixed_mult, step_mult, di
|
||||
new_dist = {}
|
||||
for val1, prob1 in c.items():
|
||||
for val2, prob2 in dist1.items():
|
||||
new_val = max(val1, val2 * mult)
|
||||
new_val = int(max(val1, val2 * mult))
|
||||
new_prob = prob1 * prob2
|
||||
|
||||
# Update the probability for the new value
|
||||
@@ -172,8 +173,8 @@ def diceSimulationStrings(categories, nbDice, nbRolls, fixed_mult, step_mult, di
|
||||
return prev_val if prev_val is not None else sorted_values[0]
|
||||
|
||||
|
||||
percReturn = [0, 0.4, 0.4, 0.45, 0.45, 0.45][diff]
|
||||
diffDivide = [0, 9, 8, 5, 4, 3][diff]
|
||||
percReturn = [0, 0.30, 0.45, 0.53, 0.7, 0.9][diff]
|
||||
diffDivide = [0, 9, 8, 4, 2, 1][diff]
|
||||
|
||||
#calculate total distribution
|
||||
total_dist = {0: 1}
|
||||
|
||||
@@ -238,7 +238,7 @@ class YachtDiceWorld(World):
|
||||
# making sure not to exceed the number of locations.
|
||||
|
||||
#first, we flood the entire pool with extra points (useful), if that setting is chosen.
|
||||
if self.options.add_extra_points.value == 1: #all of the extra points
|
||||
if self.options.add_bonus_points.value == 1: #all of the extra points
|
||||
already_items = len(self.itempool) + self.extra_plando_items + 1
|
||||
self.itempool += ["Bonus Point"] * min(self.number_of_locations - already_items, 100)
|
||||
|
||||
@@ -250,7 +250,7 @@ class YachtDiceWorld(World):
|
||||
self.itempool += ["Story Chapter"] * number_of_items
|
||||
|
||||
#add some extra points (useful)
|
||||
if self.options.add_extra_points.value == 2: #add extra points if wanted
|
||||
if self.options.add_bonus_points.value == 2: #add extra points if wanted
|
||||
already_items = len(self.itempool) + self.extra_plando_items + 1
|
||||
self.itempool += ["Bonus Point"] * min(self.number_of_locations - already_items, 10)
|
||||
|
||||
@@ -261,7 +261,7 @@ class YachtDiceWorld(World):
|
||||
self.itempool += ["Story Chapter"] * 10
|
||||
|
||||
#add some extra points if there is still room
|
||||
if self.options.add_extra_points.value == 2:
|
||||
if self.options.add_bonus_points.value == 2:
|
||||
already_items = len(self.itempool) + self.extra_plando_items + 1
|
||||
self.itempool += ["Bonus Point"] * min(self.number_of_locations - already_items, 10)
|
||||
|
||||
@@ -374,7 +374,7 @@ class YachtDiceWorld(World):
|
||||
"weight_of_points",
|
||||
"points_size",
|
||||
"minimize_extra_items",
|
||||
"add_extra_points",
|
||||
"add_bonus_points",
|
||||
"add_story_chapters",
|
||||
"which_story"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user