ClanGenOfficial / clangen

Warrior Cats fan game
https://clangen.io
Other
269 stars 481 forks source link

[BUG] Game crashes when inviting former Clancat #3056

Closed bakermor closed 2 days ago

bakermor commented 3 days ago

Type: (only select one)

Describe the bug After inviting former Clancat in leader den and timeskipping one moon the game crashes.

It looks like this is due to a line in possible_lead_den_events comparing the cat's status.casefold() ("former clancat") to the event's allowed statuses ("former Clancat"). The valid event is skipped and an empty list is returned to handle_lead_den_events.

I think we could change the line to something like cat.status.casefold() not in [x.casefold() for x in cat_info["status"]]

Grade: (only select one)

Reproduce Steps to reproduce the behavior:

  1. Have a cat with a former Clancat status
  2. Go to leader den then outsiders tab and invite them in
  3. Go to events and timeskip one moon

Commit # or Game Version Number: dabd5bb0

Additional context There was another closed issue about this connected to a PR PR: #3025

Screenshots/Evidence Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm Community Edition 2023.2.5\plugins\python-ce\helpers\pydev\pydevd.py", line 1500, in _exec pydev_imports.execfile(file, globals, locals) # execute the script ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\JetBrains\PyCharm Community Edition 2023.2.5\plugins\python-ce\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "C:\Users\mbake\Documents B\ClanGen\ClanGen\clangen\main.py", line 299, in game.all_screens[game.current_screen].on_use() File "C:\Users\mbake\Documents B\ClanGen\ClanGen\clangen\scripts\screens\EventsScreen.py", line 722, in on_use self.loading_screen_on_use(self.events_thread, self.timeskip_done) File "C:\Users\mbake\Documents B\ClanGen\ClanGen\clangen\scripts\screens\Screens.py", line 150, in loading_screen_on_use work_thread.join() File "C:\Users\mbake\Documents B\ClanGen\ClanGen\clangen\scripts\game_structure\propagating_thread.py", line 25, in join raise self.exc File "C:\Users\mbake\Documents B\ClanGen\ClanGen\clangen\scripts\game_structure\propagating_thread.py", line 18, in run self.ret = self._target(*self._args, *self._kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\mbake\Documents B\ClanGen\ClanGen\clangen\scripts\screens\Screens.py", line 117, in _work_target raise exp File "C:\Users\mbake\Documents B\ClanGen\ClanGen\clangen\scripts\screens\Screens.py", line 111, in _work_target target(args) File "C:\Users\mbake\Documents B\ClanGen\ClanGen\clangen\scripts\events.py", line 127, in one_moon self.handle_lead_den_event() File "C:\Users\mbake\Documents B\ClanGen\ClanGen\clangen\scripts\events.py", line 365, in handle_lead_den_event chosen_event = random.choice(events) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2032.0_x64__qbz5n2kfra8p0\Lib\random.py", line 347, in choice raise IndexError('Cannot choose from an empty sequence') IndexError: Cannot choose from an empty sequence python-BaseException

bakermor commented 3 days ago

/assign-me

github-actions[bot] commented 3 days ago

👋 Hey @bakermor, thanks for your interest in this issue! 🎉

âš  Note that this issue will become unassigned if it isn't closed within 7 days.

🔧 A maintainer can also add the 📌 Pinned label to prevent it from being unassigned automatically.

j-gynn commented 3 days ago

Interesting. This fix worked when I tested it for that PR... wonder what changed.