SMZ3Randomizer
SMZ3Randomizer copied to clipboard
Revise how we select responses based on counts
We've got a few bits of code that do the similar action of searching a Dictionary<int, SchrodingersString>? value for the highest key that is less than or equal to a target value:
Itemdata.TryGetTrackingResponse()AutoTracker.IncrementGTItems()Tracker.TrackDungeonTreasure()Tracker.CountHyperBeamShots()Tracker.ClearArea()(theTrackedNothingOutOfLogicpart)
It could be helpful to have an overload of the TrackerBase.Say() method that takes a Dictionary<int, SchrodingersString>? value directly and consolidates the logic that picks the matching response.
For the last item in the list above, doing this would mean we would no longer need separate TrackedNothing and TrackedNothingOutOfLogic responses, which could potentially mess with custom lines people have written.
Per Matt's suggestion below and Vivelin's thumbs-up, we should try to create a type like TieredSchrodingersString that we can pass around, instead of Dictionary<int, SchrodingersString>. We'll have to make sure such a type is still serializable to and from JSON and can still be merged across profiles.
Inspired by the code I forgot to write and had to add in #496.
I wonder if we should go as far as to create a new type for this to make coding around it simpler to implement. "TieredSchrodingersStrings" or something.
That could be a good way to make it more clear what the intent is. I'll give it a try!
Matt suggested we use an options object to cut down on the number of Say() and SayOnce() overloads. That sounds like it would be a good idea to implement while doing these changes, so I'm noting it here, so I don't forget.