The Messenger: strip generated filler items for a sufficiently small pool (#1907)
* The Messenger: strip generated filler items for a sufficiently small remaining item pool * rewrite the test for the small chance there's no large currency shards
This commit is contained in:
		| @@ -49,17 +49,14 @@ class MessengerWorld(World): | ||||
|     base_offset = 0xADD_000 | ||||
|     item_name_to_id = {item: item_id | ||||
|                        for item_id, item in enumerate(ALL_ITEMS, base_offset)} | ||||
|     seal_locs = [seal for seals in SEALS.values() for seal in seals] | ||||
|     mega_shard_locs = [shard for shards in MEGA_SHARDS.values() for shard in shards] | ||||
|     shop_locs = [f"The Shop - {shop_loc}" for shop_loc in SHOP_ITEMS] | ||||
|     location_name_to_id = {location: location_id | ||||
|                            for location_id, location in | ||||
|                            enumerate([ | ||||
|                                *ALWAYS_LOCATIONS, | ||||
|                                *seal_locs, | ||||
|                                *mega_shard_locs, | ||||
|                                *[seal for seals in SEALS.values() for seal in seals], | ||||
|                                *[shard for shards in MEGA_SHARDS.values() for shard in shards], | ||||
|                                *BOSS_LOCATIONS, | ||||
|                                *shop_locs, | ||||
|                                *[f"The Shop - {shop_loc}" for shop_loc in SHOP_ITEMS], | ||||
|                                *FIGURINES, | ||||
|                                "Money Wrench", | ||||
|                            ], base_offset)} | ||||
| @@ -127,13 +124,15 @@ class MessengerWorld(World): | ||||
|             for i in range(self.required_seals): | ||||
|                 seals[i].classification = ItemClassification.progression_skip_balancing | ||||
|             itempool += seals | ||||
|  | ||||
|          | ||||
|         remaining_fill = len(self.multiworld.get_unfilled_locations(self.player)) - len(itempool) | ||||
|         filler_pool = dict(list(FILLER.items())[2:]) if remaining_fill < 10 else FILLER | ||||
|         itempool += [self.create_item(filler_item) | ||||
|                      for filler_item in | ||||
|                      self.multiworld.random.choices( | ||||
|                          list(FILLER), | ||||
|                          weights=list(FILLER.values()), | ||||
|                          k=len(self.multiworld.get_unfilled_locations(self.player)) - len(itempool) | ||||
|                          list(filler_pool), | ||||
|                          weights=list(filler_pool.values()), | ||||
|                          k=remaining_fill | ||||
|                      )] | ||||
|  | ||||
|         self.multiworld.itempool += itempool | ||||
|   | ||||
| @@ -16,6 +16,7 @@ class ShopCostTest(MessengerTestBase): | ||||
|             with self.subTest("has cost", loc=loc): | ||||
|                 self.assertFalse(self.can_reach_location(loc)) | ||||
|  | ||||
|     def testShopPrices(self) -> None: | ||||
|         prices: Dict[str, int] = self.multiworld.worlds[self.player].shop_prices | ||||
|         for loc, price in prices.items(): | ||||
|             with self.subTest("prices", loc=loc): | ||||
| @@ -48,6 +49,15 @@ class ShopCostMinTest(ShopCostTest): | ||||
|         "shop_price": "random", | ||||
|         "shuffle_seals": "false", | ||||
|     } | ||||
|      | ||||
|     def testShopRules(self) -> None: | ||||
|         if self.multiworld.worlds[self.player].total_shards: | ||||
|             super().testShopRules() | ||||
|         else: | ||||
|             for loc in SHOP_ITEMS: | ||||
|                 loc = f"The Shop - {loc}" | ||||
|                 with self.subTest("has cost", loc=loc): | ||||
|                     self.assertTrue(self.can_reach_location(loc)) | ||||
|  | ||||
|     def testDBoost(self) -> None: | ||||
|         pass | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Aaron Wagener
					Aaron Wagener