mirror of
https://github.com/ArchipelagoMW/Archipelago.git
synced 2026-03-23 14:13:21 -07:00
ruff format styling!
This commit is contained in:
@@ -11,21 +11,19 @@ class ItemData(typing.NamedTuple):
|
||||
class YachtDiceItem(Item):
|
||||
game: str = "Yacht Dice"
|
||||
|
||||
|
||||
# the starting index is chosen semi-randomly to be 16871244000
|
||||
|
||||
|
||||
item_table = {
|
||||
# victory item, always placed manually at goal location
|
||||
"Victory": ItemData(16871244000 - 1, ItemClassification.progression),
|
||||
|
||||
"Dice": ItemData(16871244000, ItemClassification.progression),
|
||||
"Dice Fragment": ItemData(16871244001, ItemClassification.progression),
|
||||
"Roll": ItemData(16871244002, ItemClassification.progression),
|
||||
"Roll Fragment": ItemData(16871244003, ItemClassification.progression),
|
||||
|
||||
"Fixed Score Multiplier": ItemData(16871244005, ItemClassification.progression),
|
||||
"Step Score Multiplier": ItemData(16871244006, ItemClassification.progression),
|
||||
|
||||
"Category Ones": ItemData(16871244103, ItemClassification.progression),
|
||||
"Category Twos": ItemData(16871244104, ItemClassification.progression),
|
||||
"Category Threes": ItemData(16871244105, ItemClassification.progression),
|
||||
@@ -42,7 +40,6 @@ item_table = {
|
||||
"Category Large Straight": ItemData(16871244116, ItemClassification.progression),
|
||||
"Category Full House": ItemData(16871244117, ItemClassification.progression),
|
||||
"Category Yacht": ItemData(16871244118, ItemClassification.progression),
|
||||
|
||||
"Category Distincts": ItemData(16871244123, ItemClassification.progression),
|
||||
"Category Two times Ones": ItemData(16871244124, ItemClassification.progression),
|
||||
"Category Half of Sixes": ItemData(16871244125, ItemClassification.progression),
|
||||
@@ -59,7 +56,6 @@ item_table = {
|
||||
"Category 2-1-2 Consecutive": ItemData(16871244136, ItemClassification.progression),
|
||||
"Category Five Distinct Dice": ItemData(16871244137, ItemClassification.progression),
|
||||
"Category 4&5 Full House": ItemData(16871244138, ItemClassification.progression),
|
||||
|
||||
# filler items
|
||||
"Encouragement": ItemData(16871244200, ItemClassification.filler),
|
||||
"Fun Fact": ItemData(16871244201, ItemClassification.filler),
|
||||
@@ -67,19 +63,15 @@ item_table = {
|
||||
"Good RNG": ItemData(16871244203, ItemClassification.filler),
|
||||
"Bad RNG": ItemData(16871244204, ItemClassification.trap),
|
||||
"Bonus Point": ItemData(16871244205, ItemClassification.useful), # not included in logic
|
||||
|
||||
# These points are included in the logic and might be necessary to progress.
|
||||
"1 Point": ItemData(16871244301, ItemClassification.progression_skip_balancing),
|
||||
"10 Points": ItemData(16871244302, ItemClassification.progression),
|
||||
"100 Points": ItemData(16871244303, ItemClassification.progression)
|
||||
"100 Points": ItemData(16871244303, ItemClassification.progression),
|
||||
}
|
||||
|
||||
# item groups for better hinting
|
||||
item_groups = {
|
||||
"Score Multiplier": {
|
||||
"Step Score Multiplier",
|
||||
"Fixed Score Multiplier"
|
||||
},
|
||||
"Score Multiplier": {"Step Score Multiplier", "Fixed Score Multiplier"},
|
||||
"Categories": {
|
||||
"Category Ones",
|
||||
"Category Twos",
|
||||
@@ -112,6 +104,6 @@ item_groups = {
|
||||
"Category Two Pair",
|
||||
"Category 2-1-2 Consecutive",
|
||||
"Category Five Distinct Dice",
|
||||
"Category 4&5 Full House"
|
||||
}
|
||||
"Category 4&5 Full House",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ def ini_locations(goal_score, max_score, num_locs, dif):
|
||||
# note that curscore is at most max_score-1
|
||||
hiscore = 0
|
||||
for i in range(num_locs - 1):
|
||||
perc = (i / num_locs)
|
||||
curscore = int(1 + (perc ** scaling) * (max_score - 2))
|
||||
perc = i / num_locs
|
||||
curscore = int(1 + (perc**scaling) * (max_score - 2))
|
||||
if curscore <= hiscore:
|
||||
curscore = hiscore + 1
|
||||
hiscore = curscore
|
||||
|
||||
@@ -5,12 +5,13 @@ from Options import Choice, OptionGroup, PerGameCommonOptions, Range
|
||||
|
||||
class GameDifficulty(Choice):
|
||||
"""
|
||||
Difficulty. This option determines how difficult the scores are to achieve.
|
||||
Difficulty. This option determines how difficult the scores are to achieve.
|
||||
Easy: for beginners. No luck required, just roll the dice and have fun. Lower final goal.
|
||||
Medium: intended difficulty. If you play smart, you will finish the game without any trouble.
|
||||
Hard: you will need to play smart and be lucky.
|
||||
Extreme: really hard mode, which requires many brain wrinkles and insane luck. NOT RECOMMENDED FOR MULTIWORLDS.
|
||||
"""
|
||||
|
||||
display_name = "Game difficulty"
|
||||
option_easy = 1
|
||||
option_medium = 2
|
||||
@@ -22,9 +23,10 @@ class GameDifficulty(Choice):
|
||||
class ScoreForLastCheck(Range):
|
||||
"""
|
||||
The items in the item pool will always allow you to reach a score of 1000.
|
||||
By default, the last check is also at a score of 1000.
|
||||
By default, the last check is also at a score of 1000.
|
||||
However, you can set the score for the last check to be lower. This will make the game shorter and easier.
|
||||
"""
|
||||
|
||||
display_name = "Score for last check"
|
||||
range_start = 500
|
||||
range_end = 1000
|
||||
@@ -36,6 +38,7 @@ class ScoreForGoal(Range):
|
||||
This option determines what score you need to reach to finish the game.
|
||||
It cannot be higher than the score for the last check (if it is, it is changed automatically).
|
||||
"""
|
||||
|
||||
display_name = "Score for goal"
|
||||
range_start = 500
|
||||
range_end = 1000
|
||||
@@ -49,6 +52,7 @@ class MinimalNumberOfDiceAndRolls(Choice):
|
||||
You can never get more than 8 dice and 5 rolls.
|
||||
You start with one dice and one roll.
|
||||
"""
|
||||
|
||||
display_name = "Minimal number of dice and rolls in pool"
|
||||
option_5_dice_and_3_rolls = 2
|
||||
option_5_dice_and_5_rolls = 3
|
||||
@@ -60,11 +64,12 @@ class MinimalNumberOfDiceAndRolls(Choice):
|
||||
|
||||
class NumberDiceFragmentsPerDice(Range):
|
||||
"""
|
||||
Dice can be split into fragments, gathering enough will give you an extra dice.
|
||||
You start with one dice, and there will always be one full dice in the pool.
|
||||
The other dice are split into fragments, according to this option.
|
||||
Dice can be split into fragments, gathering enough will give you an extra dice.
|
||||
You start with one dice, and there will always be one full dice in the pool.
|
||||
The other dice are split into fragments, according to this option.
|
||||
Setting this to 1 fragment per dice just puts "Dice" objects in the pool.
|
||||
"""
|
||||
|
||||
display_name = "Number of dice fragments per dice"
|
||||
range_start = 1
|
||||
range_end = 5
|
||||
@@ -73,11 +78,12 @@ class NumberDiceFragmentsPerDice(Range):
|
||||
|
||||
class NumberRollFragmentsPerRoll(Range):
|
||||
"""
|
||||
Rolls can be split into fragments, gathering enough will give you an extra roll.
|
||||
You start with one roll, and there will always be one full roll in the pool.
|
||||
Rolls can be split into fragments, gathering enough will give you an extra roll.
|
||||
You start with one roll, and there will always be one full roll in the pool.
|
||||
The other three rolls are split into fragments, according to this option.
|
||||
Setting this to 1 fragment per roll just puts "Roll" objects in the pool.
|
||||
"""
|
||||
|
||||
display_name = "Number of roll fragments per roll"
|
||||
range_start = 1
|
||||
range_end = 5
|
||||
@@ -92,6 +98,7 @@ class AlternativeCategories(Range):
|
||||
In the game, you can hover over categories to check what they do.
|
||||
How many alternative categories would you like to see in your game?
|
||||
"""
|
||||
|
||||
display_name = "Number of alternative categories"
|
||||
range_start = 0
|
||||
range_end = 16
|
||||
@@ -103,9 +110,10 @@ class ChanceOfDice(Range):
|
||||
The item pool is always filled in such a way that you can reach a score of 1000.
|
||||
Extra progression items are added that will help you on your quest.
|
||||
You can set the weight for each extra progressive item in the following options.
|
||||
|
||||
|
||||
Of course, more dice = more points!
|
||||
"""
|
||||
|
||||
display_name = "Weight of adding Dice"
|
||||
range_start = 0
|
||||
range_end = 100
|
||||
@@ -116,6 +124,7 @@ class ChanceOfRoll(Range):
|
||||
"""
|
||||
With more rolls, you will be able to reach higher scores.
|
||||
"""
|
||||
|
||||
display_name = "Weight of adding Roll"
|
||||
range_start = 0
|
||||
range_end = 100
|
||||
@@ -126,6 +135,7 @@ class ChanceOfFixedScoreMultiplier(Range):
|
||||
"""
|
||||
Getting a Fixed Score Multiplier will boost all future scores by 10%.
|
||||
"""
|
||||
|
||||
display_name = "Weight of adding Fixed Score Multiplier"
|
||||
range_start = 0
|
||||
range_end = 100
|
||||
@@ -138,6 +148,7 @@ class ChanceOfStepScoreMultiplier(Range):
|
||||
So, keep high scoring categories for later to get the most out of them.
|
||||
By default, this item is not included. It is fun however, you just need to know the above strategy.
|
||||
"""
|
||||
|
||||
display_name = "Weight of adding Step Score Multiplier"
|
||||
range_start = 0
|
||||
range_end = 100
|
||||
@@ -149,6 +160,7 @@ class ChanceOfDoubleCategory(Range):
|
||||
This option allows categories to appear multiple times.
|
||||
Each time you get a category after the first, its score value gets doubled.
|
||||
"""
|
||||
|
||||
display_name = "Weight of adding Category copy"
|
||||
range_start = 0
|
||||
range_end = 100
|
||||
@@ -159,6 +171,7 @@ class ChanceOfPoints(Range):
|
||||
"""
|
||||
Getting points gives you... points. You can get 1 point, 10 points, and even 100 points.
|
||||
"""
|
||||
|
||||
display_name = "Weight of adding Points"
|
||||
range_start = 0
|
||||
range_end = 100
|
||||
@@ -167,9 +180,10 @@ class ChanceOfPoints(Range):
|
||||
|
||||
class PointsSize(Choice):
|
||||
"""
|
||||
If you choose to add points to the item pool, do you prefer many small points,
|
||||
If you choose to add points to the item pool, do you prefer many small points,
|
||||
medium-size points, a few larger points, or a mix of them?
|
||||
"""
|
||||
|
||||
display_name = "Size of points"
|
||||
option_small = 1
|
||||
option_medium = 2
|
||||
@@ -182,9 +196,10 @@ 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?
|
||||
Do you want to reduce the number of extra items?
|
||||
(this option only does something in multiplayer games)
|
||||
"""
|
||||
|
||||
display_name = "Minimize extra items"
|
||||
option_no_dont = 1
|
||||
option_yes_please = 2
|
||||
@@ -196,11 +211,12 @@ class AddExtraPoints(Choice):
|
||||
Yacht Dice typically has space for extra items.
|
||||
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 bonus points in
|
||||
never: do not put any bonus points
|
||||
"""
|
||||
|
||||
display_name = "Extra bonus in the pool"
|
||||
option_all_of_it = 1
|
||||
option_sure = 2
|
||||
@@ -213,11 +229,12 @@ class AddStoryChapters(Choice):
|
||||
Yacht Dice typically has space for more items.
|
||||
If there is space, would you like story chapters shuffled in the item pool?
|
||||
Note: if you have extra points on "all_of_it", there will not be story chapters.
|
||||
|
||||
|
||||
all_of_it: fill all locations with story chapters
|
||||
sure: if there is space left, put in 10 story chapters.
|
||||
never: do not put any story chapters in, I do not like reading (but I am glad you are reading THIS!)
|
||||
"""
|
||||
|
||||
display_name = "Extra story chapters in the pool"
|
||||
option_all_of_it = 1
|
||||
option_sure = 2
|
||||
@@ -232,6 +249,7 @@ class WhichStory(Choice):
|
||||
You can read story chapters in the feed on the website.
|
||||
Which story would you like to read?
|
||||
"""
|
||||
|
||||
display_name = "Story"
|
||||
option_the_quest_of_the_dice_warrior = 1
|
||||
option_the_tragedy_of_fortunas_gambit = 2
|
||||
@@ -250,6 +268,7 @@ class AllowManual(Choice):
|
||||
Of course, we cannot check anymore if the player is playing fair.
|
||||
Do you want to allow manual input of rolls?
|
||||
"""
|
||||
|
||||
display_name = "Allow manual inputs"
|
||||
option_yes_allow = 1
|
||||
option_no_dont_allow = 2
|
||||
@@ -286,12 +305,17 @@ class YachtDiceOptions(PerGameCommonOptions):
|
||||
|
||||
|
||||
yd_option_groups = [
|
||||
OptionGroup("Extra progression items", [
|
||||
ChanceOfDice, ChanceOfRoll, ChanceOfFixedScoreMultiplier, ChanceOfStepScoreMultiplier,
|
||||
ChanceOfDoubleCategory, ChanceOfPoints, PointsSize
|
||||
]),
|
||||
|
||||
OptionGroup("Other items", [
|
||||
MinimizeExtraItems, AddExtraPoints, AddStoryChapters, WhichStory
|
||||
])
|
||||
OptionGroup(
|
||||
"Extra progression items",
|
||||
[
|
||||
ChanceOfDice,
|
||||
ChanceOfRoll,
|
||||
ChanceOfFixedScoreMultiplier,
|
||||
ChanceOfStepScoreMultiplier,
|
||||
ChanceOfDoubleCategory,
|
||||
ChanceOfPoints,
|
||||
PointsSize,
|
||||
],
|
||||
),
|
||||
OptionGroup("Other items", [MinimizeExtraItems, AddExtraPoints, AddStoryChapters, WhichStory]),
|
||||
]
|
||||
|
||||
@@ -25,7 +25,6 @@ category_mappings = {
|
||||
"Category Large Straight": "LargeStraight",
|
||||
"Category Full House": "FullHouse",
|
||||
"Category Yacht": "Yacht",
|
||||
|
||||
"Category Distincts": "Distincts",
|
||||
"Category Two times Ones": "Twos", # same weights as twos category
|
||||
"Category Half of Sixes": "Threes", # same weights as threes category
|
||||
@@ -41,7 +40,7 @@ category_mappings = {
|
||||
"Category Two Pair": "TwoPair",
|
||||
"Category 2-1-2 Consecutive": "TwoOneTwoConsecutive",
|
||||
"Category Five Distinct Dice": "FiveDistinctDice",
|
||||
"Category 4&5 Full House": "FourAndFiveFullHouse"
|
||||
"Category 4&5 Full House": "FourAndFiveFullHouse",
|
||||
}
|
||||
|
||||
# This class adds logic to the apworld.
|
||||
@@ -74,12 +73,10 @@ def extract_progression(state, player, options):
|
||||
|
||||
if player == "state_is_a_list": # the state variable is just a list with the names of the items
|
||||
number_of_dice = (
|
||||
state.count("Dice")
|
||||
+ state.count("Dice Fragment") // options.number_of_dice_fragments_per_dice.value
|
||||
state.count("Dice") + state.count("Dice Fragment") // options.number_of_dice_fragments_per_dice.value
|
||||
)
|
||||
number_of_rerolls = (
|
||||
state.count("Roll")
|
||||
+ state.count("Roll Fragment") // options.number_of_roll_fragments_per_roll.value
|
||||
state.count("Roll") + state.count("Roll Fragment") // options.number_of_roll_fragments_per_roll.value
|
||||
)
|
||||
number_of_fixed_mults = state.count("Fixed Score Multiplier")
|
||||
number_of_step_mults = state.count("Step Score Multiplier")
|
||||
@@ -109,8 +106,15 @@ def extract_progression(state, player, options):
|
||||
extra_points_in_logic += state.count("10 Points", player) * 10
|
||||
extra_points_in_logic += state.count("100 Points", player) * 100
|
||||
|
||||
return [categories, number_of_dice, number_of_rerolls,
|
||||
number_of_fixed_mults * 0.1, number_of_step_mults * 0.01, extra_points_in_logic]
|
||||
return [
|
||||
categories,
|
||||
number_of_dice,
|
||||
number_of_rerolls,
|
||||
number_of_fixed_mults * 0.1,
|
||||
number_of_step_mults * 0.01,
|
||||
extra_points_in_logic,
|
||||
]
|
||||
|
||||
|
||||
# We will store the results of this function as it is called often for the same parameters.
|
||||
|
||||
@@ -120,8 +124,16 @@ yachtdice_cache = {}
|
||||
|
||||
# Function that returns the feasible score in logic based on items obtained.
|
||||
def dice_simulation_strings(categories, num_dice, num_rolls, fixed_mult, step_mult, diff):
|
||||
tup = tuple([tuple(sorted([c.name + str(c.quantity) for c in categories])),
|
||||
num_dice, num_rolls, fixed_mult, step_mult, diff]) # identifier
|
||||
tup = tuple(
|
||||
[
|
||||
tuple(sorted([c.name + str(c.quantity) for c in categories])),
|
||||
num_dice,
|
||||
num_rolls,
|
||||
fixed_mult,
|
||||
step_mult,
|
||||
diff,
|
||||
]
|
||||
) # identifier
|
||||
|
||||
# if already computed, return the result
|
||||
if tup in yachtdice_cache.keys():
|
||||
@@ -210,16 +222,22 @@ def dice_simulation_strings(categories, num_dice, num_rolls, fixed_mult, step_mu
|
||||
def dice_simulation(state, player, options):
|
||||
if player == "state_is_a_list":
|
||||
categories, num_dice, num_rolls, fixed_mult, step_mult, expoints = extract_progression(state, player, options)
|
||||
return dice_simulation_strings(
|
||||
categories, num_dice, num_rolls, fixed_mult, step_mult, 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
|
||||
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"]
|
||||
|
||||
@@ -227,11 +245,11 @@ def dice_simulation(state, player, options):
|
||||
# Sets rules on entrances and advancements that are always applied
|
||||
def set_yacht_rules(world: MultiWorld, player: int, options):
|
||||
for l in world.get_locations(player):
|
||||
set_rule(l,
|
||||
lambda state,
|
||||
curscore=l.yacht_dice_score,
|
||||
player=player:
|
||||
dice_simulation(state, player, options) >= curscore)
|
||||
set_rule(
|
||||
l,
|
||||
lambda state, curscore=l.yacht_dice_score, player=player: dice_simulation(state, player, options)
|
||||
>= curscore,
|
||||
)
|
||||
|
||||
|
||||
# Sets rules on completion condition
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -11,28 +11,30 @@ from .Rules import dice_simulation, set_yacht_completion_rules, set_yacht_rules
|
||||
|
||||
|
||||
class YachtDiceWeb(WebWorld):
|
||||
tutorials = [Tutorial(
|
||||
"Multiworld Setup Guide",
|
||||
"A guide to setting up Yacht Dice. This guide covers "
|
||||
"single-player, multiworld, and website.",
|
||||
"English",
|
||||
"setup_en.md",
|
||||
"setup/en",
|
||||
["Spineraks"]
|
||||
)]
|
||||
tutorials = [
|
||||
Tutorial(
|
||||
"Multiworld Setup Guide",
|
||||
"A guide to setting up Yacht Dice. This guide covers " "single-player, multiworld, and website.",
|
||||
"English",
|
||||
"setup_en.md",
|
||||
"setup/en",
|
||||
["Spineraks"],
|
||||
)
|
||||
]
|
||||
|
||||
option_groups = yd_option_groups
|
||||
|
||||
|
||||
class YachtDiceWorld(World):
|
||||
"""
|
||||
Yacht Dice is a straightforward game, custom-made for Archipelago,
|
||||
where you cast your dice to chart a course for high scores,
|
||||
unlocking valuable treasures along the way.
|
||||
Discover more dice, extra rolls, multipliers,
|
||||
and unlockable categories to navigate the depths of the game.
|
||||
Yacht Dice is a straightforward game, custom-made for Archipelago,
|
||||
where you cast your dice to chart a course for high scores,
|
||||
unlocking valuable treasures along the way.
|
||||
Discover more dice, extra rolls, multipliers,
|
||||
and unlockable categories to navigate the depths of the game.
|
||||
Roll your way to victory by reaching the target score!
|
||||
"""
|
||||
|
||||
game: str = "Yacht Dice"
|
||||
options_dataclass = YachtDiceOptions
|
||||
|
||||
@@ -103,7 +105,7 @@ class YachtDiceWorld(World):
|
||||
["Category Small Straight", "Category Two Pair"],
|
||||
["Category Large Straight", "Category 2-1-2 Consecutive"],
|
||||
["Category Full House", "Category Five Distinct Dice"],
|
||||
["Category Yacht", "Category 4&5 Full House"]
|
||||
["Category Yacht", "Category 4&5 Full House"],
|
||||
]
|
||||
|
||||
# categories used in this game.
|
||||
@@ -159,7 +161,7 @@ class YachtDiceWorld(World):
|
||||
self.options.weight_of_fixed_score_multiplier.value,
|
||||
self.options.weight_of_step_score_multiplier.value,
|
||||
self.options.weight_of_double_category.value,
|
||||
self.options.weight_of_points.value
|
||||
self.options.weight_of_points.value,
|
||||
]
|
||||
|
||||
# if the player wants extra rolls or dice, fill the pool with fragments until close to an extra roll/dice
|
||||
@@ -209,13 +211,13 @@ class YachtDiceWorld(World):
|
||||
self.itempool += ["Dice"]
|
||||
else:
|
||||
self.itempool += ["Dice Fragment"]
|
||||
weights[0] /= (1 + frags_per_dice)
|
||||
weights[0] /= 1 + frags_per_dice
|
||||
elif which_item_to_add == 1:
|
||||
if frags_per_roll == 1:
|
||||
self.itempool += ["Roll"]
|
||||
else:
|
||||
self.itempool += ["Roll Fragment"]
|
||||
weights[1] /= (1 + frags_per_roll)
|
||||
weights[1] /= 1 + frags_per_roll
|
||||
elif which_item_to_add == 2:
|
||||
self.itempool += ["Fixed Score Multiplier"]
|
||||
weights[2] /= 1.05
|
||||
@@ -310,16 +312,16 @@ class YachtDiceWorld(World):
|
||||
p = 1.1 - 0.25 * self.options.game_difficulty.value
|
||||
already_items = len(self.itempool) + self.extra_plando_items + 1
|
||||
self.itempool += self.multiworld.random.choices(
|
||||
["Good RNG", "Bad RNG"],
|
||||
weights=[p, 1 - p],
|
||||
k=self.number_of_locations - already_items
|
||||
["Good RNG", "Bad RNG"], weights=[p, 1 - p], k=self.number_of_locations - already_items
|
||||
)
|
||||
|
||||
# we are done adding items. Now because of the last step, number of items should be number of locations
|
||||
already_items = len(self.itempool) + self.extra_plando_items + 1
|
||||
if already_items != self.number_of_locations:
|
||||
raise Exception(f"[Yacht Dice] Number in self.itempool is not number of locations "
|
||||
f"{already_items} {self.number_of_locations}.")
|
||||
raise Exception(
|
||||
f"[Yacht Dice] Number in self.itempool is not number of locations "
|
||||
f"{already_items} {self.number_of_locations}."
|
||||
)
|
||||
|
||||
# add precollected items using push_precollected. Items in self.itempool get created in create_items
|
||||
for item in self.precollected:
|
||||
@@ -334,16 +336,20 @@ class YachtDiceWorld(World):
|
||||
|
||||
def create_regions(self):
|
||||
# call the ini_locations function, that generates locations based on the inputs.
|
||||
location_table, goal_index = ini_locations(self.goal_score, self.max_score, self.number_of_locations,
|
||||
self.options.game_difficulty.value)
|
||||
location_table, goal_index = ini_locations(
|
||||
self.goal_score, self.max_score, self.number_of_locations, self.options.game_difficulty.value
|
||||
)
|
||||
|
||||
# simple menu-board construction
|
||||
menu = Region("Menu", self.player, self.multiworld)
|
||||
board = Region("Board", self.player, self.multiworld)
|
||||
|
||||
# add locations to board, one for every location in the location_table
|
||||
board.locations = [YachtDiceLocation(self.player, loc_name, loc_data.score, loc_data.id, board)
|
||||
for loc_name, loc_data in location_table.items() if loc_data.region == board.name]
|
||||
board.locations = [
|
||||
YachtDiceLocation(self.player, loc_name, loc_data.score, loc_data.id, board)
|
||||
for loc_name, loc_data in location_table.items()
|
||||
if loc_data.region == board.name
|
||||
]
|
||||
|
||||
# which index of all locations should have the Victory item.
|
||||
|
||||
@@ -370,25 +376,25 @@ class YachtDiceWorld(World):
|
||||
# make slot data, which consists of yachtdice_data, options, and some other variables.
|
||||
yacht_dice_data = self._get_yachtdice_data()
|
||||
yacht_dice_options = self.options.as_dict(
|
||||
"game_difficulty",
|
||||
"score_for_last_check",
|
||||
"score_for_goal",
|
||||
"minimal_number_of_dice_and_rolls",
|
||||
"number_of_dice_fragments_per_dice",
|
||||
"number_of_roll_fragments_per_roll",
|
||||
"alternative_categories",
|
||||
"weight_of_dice",
|
||||
"weight_of_roll",
|
||||
"weight_of_fixed_score_multiplier",
|
||||
"weight_of_step_score_multiplier",
|
||||
"weight_of_double_category",
|
||||
"weight_of_points",
|
||||
"points_size",
|
||||
"minimize_extra_items",
|
||||
"add_bonus_points",
|
||||
"add_story_chapters",
|
||||
"which_story",
|
||||
"allow_manual_input"
|
||||
"game_difficulty",
|
||||
"score_for_last_check",
|
||||
"score_for_goal",
|
||||
"minimal_number_of_dice_and_rolls",
|
||||
"number_of_dice_fragments_per_dice",
|
||||
"number_of_roll_fragments_per_roll",
|
||||
"alternative_categories",
|
||||
"weight_of_dice",
|
||||
"weight_of_roll",
|
||||
"weight_of_fixed_score_multiplier",
|
||||
"weight_of_step_score_multiplier",
|
||||
"weight_of_double_category",
|
||||
"weight_of_points",
|
||||
"points_size",
|
||||
"minimize_extra_items",
|
||||
"add_bonus_points",
|
||||
"add_story_chapters",
|
||||
"which_story",
|
||||
"allow_manual_input",
|
||||
)
|
||||
slot_data = {**yacht_dice_data, **yacht_dice_options} # combine the two
|
||||
slot_data["goal_score"] = self.goal_score
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
line-length = 120
|
||||
|
||||
[lint]
|
||||
preview = true
|
||||
select = ["E", "F", "W", "I", "N", "Q", "UP", "RUF", "ISC", "T20"]
|
||||
ignore = ["RUF012", "RUF100"]
|
||||
|
||||
[per-file-ignores]
|
||||
# The way options definitions work right now, world devs are forced to break line length requirements.
|
||||
"options.py" = ["E501"]
|
||||
# Yu Gi Oh specific: The structure of the Opponents.py file makes the line length violations acceptable.
|
||||
"YachtWeights.py" = ["E501"]
|
||||
Reference in New Issue
Block a user