Skip to content

Commit b77a8e4

Browse files
The Messenger: bump required client version
1 parent 0c1fa6e commit b77a8e4

File tree

3 files changed

+31
-8
lines changed

3 files changed

+31
-8
lines changed

worlds/messenger/__init__.py

+15-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
from datetime import date
23
from typing import Any, ClassVar, Dict, List, Optional, TextIO
34

45
from BaseClasses import CollectionState, Entrance, Item, ItemClassification, MultiWorld, Tutorial
@@ -9,7 +10,8 @@
910
from worlds.LauncherComponents import Component, Type, components
1011
from .client_setup import launch_game
1112
from .connections import CONNECTIONS, RANDOMIZED_CONNECTIONS, TRANSITIONS
12-
from .constants import ALL_ITEMS, ALWAYS_LOCATIONS, BOSS_LOCATIONS, FILLER, NOTES, PHOBEKINS, PROG_ITEMS, USEFUL_ITEMS
13+
from .constants import ALL_ITEMS, ALWAYS_LOCATIONS, BOSS_LOCATIONS, FILLER, NOTES, PHOBEKINS, PROG_ITEMS, TRAPS, \
14+
USEFUL_ITEMS
1315
from .options import AvailablePortals, Goal, Logic, MessengerOptions, NotesNeeded, ShuffleTransitions
1416
from .portals import PORTALS, add_closed_portal_reqs, disconnect_portals, shuffle_portals, validate_portals
1517
from .regions import LEVELS, MEGA_SHARDS, LOCATIONS, REGION_CONNECTIONS
@@ -110,7 +112,7 @@ class MessengerWorld(World):
110112
},
111113
}
112114

113-
required_client_version = (0, 4, 3)
115+
required_client_version = (0, 4, 4)
114116

115117
web = MessengerWeb()
116118

@@ -127,6 +129,7 @@ class MessengerWorld(World):
127129
portal_mapping: List[int]
128130
transitions: List[Entrance]
129131
reachable_locs: int = 0
132+
filler: Dict[str, int]
130133

131134
def generate_early(self) -> None:
132135
if self.options.goal == Goal.option_power_seal_hunt:
@@ -156,6 +159,10 @@ def generate_early(self) -> None:
156159
if portal in self.starting_portals]
157160
self.starting_portals.remove(self.random.choice(portals_to_strip))
158161

162+
self.filler = FILLER.copy()
163+
if (not hasattr(self.options, "traps") and date.today() < date(2024, 4, 2)) or self.options.traps:
164+
self.filler.update(TRAPS)
165+
159166
self.plando_portals = []
160167
self.portal_mapping = []
161168
self.spoiler_portal_mapping = {}
@@ -187,9 +194,9 @@ def create_items(self) -> None:
187194
itempool: List[MessengerItem] = [
188195
self.create_item(item)
189196
for item in self.item_name_to_id
190-
if "Time Shard" not in item and item not in {
197+
if item not in {
191198
"Power Seal", *NOTES, *FIGURINES, *main_movement_items,
192-
*precollected_names,
199+
*precollected_names, *FILLER, *TRAPS,
193200
}
194201
]
195202

@@ -230,8 +237,8 @@ def create_items(self) -> None:
230237
remaining_fill = len(self.multiworld.get_unfilled_locations(self.player)) - len(itempool)
231238
if remaining_fill < 10:
232239
self._filler_items = self.random.choices(
233-
list(FILLER)[2:],
234-
weights=list(FILLER.values())[2:],
240+
list(self.filler)[2:],
241+
weights=list(self.filler.values())[2:],
235242
k=remaining_fill
236243
)
237244
filler = [self.create_filler() for _ in range(remaining_fill)]
@@ -302,8 +309,8 @@ def fill_slot_data(self) -> Dict[str, Any]:
302309
def get_filler_item_name(self) -> str:
303310
if not getattr(self, "_filler_items", None):
304311
self._filler_items = [name for name in self.random.choices(
305-
list(FILLER),
306-
weights=list(FILLER.values()),
312+
list(self.filler),
313+
weights=list(self.filler.values()),
307314
k=20
308315
)]
309316
return self._filler_items.pop(0)

worlds/messenger/constants.py

+7
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@
4848
"Time Shard (500)": 5,
4949
}
5050

51+
TRAPS = {
52+
"Teleport Trap": 5,
53+
"Prophecy Trap": 10,
54+
}
55+
5156
# item_name_to_id needs to be deterministic and match upstream
5257
ALL_ITEMS = [
5358
*NOTES,
@@ -71,6 +76,8 @@
7176
*SHOP_ITEMS,
7277
*FIGURINES,
7378
"Money Wrench",
79+
"Teleport Trap",
80+
"Prophecy Trap",
7481
]
7582

7683
# locations

worlds/messenger/options.py

+9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from dataclasses import dataclass
2+
from datetime import date
23
from typing import Dict
34

45
from schema import And, Optional, Or, Schema
@@ -123,6 +124,11 @@ class RequiredSeals(Range):
123124
default = range_end
124125

125126

127+
class Traps(Toggle):
128+
"""Whether traps should be included in the itempool."""
129+
display_name = "Include Traps"
130+
131+
126132
class ShopPrices(Range):
127133
"""Percentage modifier for shuffled item prices in shops"""
128134
display_name = "Shop Prices Modifier"
@@ -199,3 +205,6 @@ class MessengerOptions(DeathLinkMixin, PerGameCommonOptions):
199205
percent_seals_required: RequiredSeals
200206
shop_price: ShopPrices
201207
shop_price_plan: PlannedShopPrices
208+
209+
if date.today() > date(2024, 4, 1):
210+
traps: Traps

0 commit comments

Comments
 (0)