id Tech Games: Customizable ammo capacity (#3565)

* Doom, Doom 2, Heretic: customizable ammo capacity

* Do not progression balance capacity up items

* Prog fill still doesn't agree, just go with our original idea

* Clean up the new options a bit

- Gave all options a consistent and easily readable naming scheme
  (`max_ammo_<type>` and `added_ammo_<type>`)
- Don't show the new options in the spoiler log,
  as they do not affect logic
- Fix the Doom games' Split Backpack option accidentally referring to
  Heretic's Bag of Holding

The logging change across all three games is incidental, as at some
point I did run into that condition by happenstance and it turns out
that it throws an exception due to bad formatting if it's reached

* Do the visibility change for Heretic as well

* Update required client version

* Remove spoiler log restriction on options

* Remove Visibility import now made redundant
This commit is contained in:
Kaito Sinclaire
2025-03-08 07:37:54 -08:00
committed by GitHub
parent 00a6ac3a52
commit b5269e9aa4
10 changed files with 469 additions and 19 deletions

View File

@@ -43,7 +43,7 @@ class DOOM2World(World):
options: DOOM2Options
game = "DOOM II"
web = DOOM2Web()
required_client_version = (0, 3, 9)
required_client_version = (0, 5, 0) # 1.2.0-prerelease or higher
item_name_to_id = {data["name"]: item_id for item_id, data in Items.item_table.items()}
item_name_groups = Items.item_name_groups
@@ -196,6 +196,15 @@ class DOOM2World(World):
count = item["count"] if item["name"] not in self.starting_level_for_episode else item["count"] - 1
itempool += [self.create_item(item["name"]) for _ in range(count)]
# Backpack(s) based on options
if self.options.split_backpack.value:
itempool += [self.create_item("Bullet capacity") for _ in range(self.options.backpack_count.value)]
itempool += [self.create_item("Shell capacity") for _ in range(self.options.backpack_count.value)]
itempool += [self.create_item("Energy cell capacity") for _ in range(self.options.backpack_count.value)]
itempool += [self.create_item("Rocket capacity") for _ in range(self.options.backpack_count.value)]
else:
itempool += [self.create_item("Backpack") for _ in range(self.options.backpack_count.value)]
# Place end level items in locked locations
for map_name in Maps.map_names:
loc_name = map_name + " - Exit"
@@ -258,11 +267,23 @@ class DOOM2World(World):
# Was balanced based on DOOM 1993's first 3 episodes
count = min(remaining_loc, max(1, int(round(self.items_ratio[item_name] * ep_count / 3))))
if count == 0:
logger.warning("Warning, no ", item_name, " will be placed.")
logger.warning(f"Warning, no {item_name} will be placed.")
return
for i in range(count):
itempool.append(self.create_item(item_name))
def fill_slot_data(self) -> Dict[str, Any]:
return self.options.as_dict("difficulty", "random_monsters", "random_pickups", "random_music", "flip_levels", "allow_death_logic", "pro", "death_link", "reset_level_on_death", "episode1", "episode2", "episode3", "episode4")
slot_data = self.options.as_dict("difficulty", "random_monsters", "random_pickups", "random_music", "flip_levels", "allow_death_logic", "pro", "death_link", "reset_level_on_death", "episode1", "episode2", "episode3", "episode4")
# Send slot data for ammo capacity values; this must be generic because Heretic uses it too
slot_data["ammo1start"] = self.options.max_ammo_bullets.value
slot_data["ammo2start"] = self.options.max_ammo_shells.value
slot_data["ammo3start"] = self.options.max_ammo_energy_cells.value
slot_data["ammo4start"] = self.options.max_ammo_rockets.value
slot_data["ammo1add"] = self.options.added_ammo_bullets.value
slot_data["ammo2add"] = self.options.added_ammo_shells.value
slot_data["ammo3add"] = self.options.added_ammo_energy_cells.value
slot_data["ammo4add"] = self.options.added_ammo_rockets.value
return slot_data