JenShin-368 / GenshinImpactCalculator

Genshin Impact Damage Calculator and Optimizer
26 stars 2 forks source link

Certain inputs reset incorrectly when switching character slots #43

Closed briankchan closed 3 years ago

briankchan commented 3 years ago

When switching away from a character slot, not all inputs reset properly, and not all settings save properly. Settings I've noticed:

Steps to reproduce

  1. Add a character (so that there are at least 2 slots used)
  2. Change the above settings from their default values on Character 1
  3. Switch to Character 2
    • If Character 2 does not already have a setting for "Affected by," then the radio option will remain the same as in Character 1 (but the value used in calculations will be "None"). (If Character 2 already had "Affected by" set previously, then its previous value will be restored and applied correctly; the bug only happens if its "Affected by" setting has not been changed before.)
    • "Switch to Reaction Mode" will still be checked, but will not be enabled.
    • "Elemental Reaction Proc Chance" will not have changed; it will not take effect since reaction mode will be disabled, but enabling reaction mode will correctly apply this proc chance (assuming that persisting the proc chance between slots is correct?).
  4. Switch back to Character 1
    • "Optimization target" has been reset to "Default."
    • "Affected by" gets correctly reset to its setting for Character 1.
    • "Switch to Reaction Mode" will still be checked, but will not be enabled.
    • "Elemental Reaction Proc Chance" will not have changed.

Expected behavior Honestly, I have no idea what's supposed to happen.

The most consistent behavior would be for all settings to be tied to their slot: switching to a different slot will apply all the settings from the new slot and update all the inputs to match. All settings would save when applied so that switching away from a slot, then back to it will end up with the same settings/inputs.

There are some times when I want all enemy modifiers and reaction mode settings to apply to multiple slots, though.

JenShin-368 commented 3 years ago

Optimization Target is a calculator setting so does not get saved into your build. However, I've added a cache so that it will remember your target for each slot when using the calculator (new slots, including copied ones, or loaded ones, will still be preset to Default when first loaded in).

Affected by desyncing for "None" has been fixed.

Reaction Mode is a GUI setting and only changes your view. The intended behavior is that switching between characters will still display Reaction Mode with the same Proc Chance. The bug preventing this behavior has been fixed.

The reaction mode vs enemy calc inconsistency might be confusing, but a rework will be needed to change that. Eventually, reaction mode might be implemented as a subset of enemy calc.