ArchipelagoMW / Archipelago

Archipelago Multi-Game Randomizer and Server
https://archipelago.gg
Other
480 stars 638 forks source link

Core: Added new roll_triggers functionality and created two helper functions to support it. #3539

Open Vertraic opened 3 months ago

Vertraic commented 3 months ago

What is this fixing or adding?

Keeps the current trigger functionality, while adding the ability to use comparators (<, >) for numerical values, and to and/or multiple conditions together for more complex triggers. This required adding random-range-min-max resolution to roll_triggers. random/random-range-low/high are not included in this resolution. If the new option "option_advanced" is not included, triggers will work exactly as before, with the exception of resolving random-range-min-max. For multiple option comparison, And takes priority, so if you look for options: A & B & C | B & D | A & E & F it will logically group them as: (A & B & C) | (B & D) | (A & E & F)

Format is as follows in the trigger options, replace list dots with - : option_advanced:

the comparator accepts '<', '=', '!=', '>' and defaults to '=' if only two entries are given. &/0/and/And/AND all represent an AND operation, while |/1/or/Or/OR both represent and OR operation.

option_name/option_result are un-needed when option_advanced is present.

Example: triggers:

This says that if crystals needed for gt is more than 2 and less than 6, and crystals needed for ganon is 4 OR if goal is triforce hunt and triforce pieces mode is set to percentage, then swordless will be set to true.

How was this tested?

Unit tests were run to see if anything outside triggers had broken, and I tried old trigger styles to ensure they still worked, and then tried each new feature separately, and in multiple combinations while checking that the resulting settings were as expected, including making sure random-range-min-max permanently resolved to a constant value for that game's generation. Finally, I ran a generation with every supported game that A: Does not require you to possess a copy of, or B: That I possess a copy of. including both old and new triggers in two of them. The generation was successful with no errors, and all the game's settings were as expected, including merged values for start_inventory.

If this makes graphical changes, please attach screenshots.

No graphical changes were made.

Exempt-Medic commented 3 months ago

Since you're updating these, you should also update the triggers guide to include examples of all of these new functions

benny-dreamly commented 1 month ago

would 100% use this as a sync host.