Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stat Ratings Refactor #883

Merged
merged 80 commits into from
Aug 18, 2024
Merged

Stat Ratings Refactor #883

merged 80 commits into from
Aug 18, 2024

Conversation

NerdEgghead
Copy link
Contributor

@NerdEgghead NerdEgghead commented Jul 28, 2024

This PR aims to clean up our internal stats representations by storing secondary stat gear Ratings (HitRating, CritRating, HasteRating) separately from fully buffed school-specific metrics (PhysicalHit / SpellHit, PhysicalCrit / SpellCrit, MeleeHaste / RangedHaste / SpellHaste). Separating these out in the codebase for cleanliness has been a stretch goal for quite some time, but the impetus for making the change now is so that Firelands trinkets like Matrix Restabilizer and Apparatus of Khaz'goroth will be modeled correctly in the sim.

At a high level, the following changes are made:

  • Units are explicitly included in all Stat and PseudoStat names for clarity.
  • The following "pure Rating only" stats are added to the Stat enum: HitRating, CritRating, and HasteRating.
  • Block, MeleeHaste, and SpellHaste are moved to the PseudoStat enum, since these do not need to be separately tracked and manipulated by the sim.
  • The fromStat and toStat fields of the ReforgeStat message are changed from arrays to scalars, since they can now be represented by a single Rating stat.
  • Configuration of display stats for individual sim UIs and soft cap breakpoints for the auto-Reforge tool is now done via UnitStat objects rather than Stat enum values. This allows SpellHaste to be removed from the sim's internal stats representation while still allowing the final buffed Haste value to be viewed and capped in the front-end.

PseudoStat representations so that they can be peer-reviewed before
effort is spent on migrating the codebase to the new schema.

 On branch stats_refactor
 Changes to be committed:
	modified:   proto/common.proto
	modified:   proto/ui.proto
	modified:   sim/core/stats/stats.go
	modified:   ui/core/individual_sim_ui.tsx
messages. This enables a tighter proto Stat enum that contains only
essential stats that need to be saved in database files or Encounter
settings, while still retaining the benefits of StatDependency structs
for tertiary stats in the back-end.

 On branch stats_refactor
 Changes to be committed:
	modified:   proto/common.proto
	modified:   sim/core/stats/stats.go
 On branch stats_refactor
 Changes to be committed:
	modified:   sim/core/stats/deps.go
	modified:   sim/core/stats/stats.go
representation, for the sake of back-end migration convenience.

 On branch stats_refactor
 Changes to be committed:
	modified:   proto/common.proto
	modified:   sim/core/stats/deps.go
	modified:   sim/core/stats/stats.go
 On branch stats_refactor
 Changes to be committed:
	modified:   sim/core/base_stats_auto_gen.go
	modified:   tools/base_stats_parser.py
removed incorrect / unused constants for Cata.

 On branch stats_refactor
 Changes to be committed:
	modified:   sim/core/base_stats_auto_gen.go
	modified:   tools/base_stats_parser.py
explicit in the name.

 On branch stats_refactor
 Changes to be committed:
	modified:   sim/core/stats/stats.go
 On branch stats_refactor
 Changes to be committed:
	modified:   proto/common.proto
units for consistency with the other stats changes.

 On branch stats_refactor
 Changes to be committed:
	modified:   sim/core/stats/stats.go
debuffs provide this.

 On branch stats_refactor
 Changes to be committed:
	modified:   sim/core/debuffs.go
	modified:   sim/core/stats/stats.go
percentage units for consistency with other stats changes.

 On branch stats_refactor
 Changes to be committed:
	modified:   sim/core/spell.go
order to avoid inconsistent interpretations of percentages in the
codebase.

 On branch stats_refactor
 Changes to be committed:
	modified:   sim/core/spell_outcome.go
	modified:   sim/core/spell_result.go
entirely, as further inspection reveals that they are never used in
Cata.

 On branch stats_refactor
 Changes to be committed:
	modified:   sim/core/stats/stats.go
stats.ToFloatArray() to stats.ToProtoArray() for clarity, since
SimStatsLen and ProtoStatsLen no longer need to match. Also fixed a bug
in UnitStat.EqualsPseudoStat(), which may be utilized in future stat
weights refactors.

 On branch stats_refactor
 Changes to be committed:
	modified:   sim/core/stats/stats.go
and school-specific Hit / Crit percentages. Added utility function for
importing tertiary stats that are stored as PseudoStats in UnitStats
messages into back-end Stats arrays. Also added support for exporting
these tertiary stats to UnitStats protos during character stats
requests. The net impact of these utilities is that the proto Stat enum
can be kept very lean, including only essential entries for database
files and NPC target stats, without compromising the ability to pass
tertiary stat data between the front-end and back-end code.

 On branch stats_refactor
 Changes to be committed:
	modified:   sim/core/character.go
	modified:   sim/core/target.go
	modified:   sim/core/test_suite.go
	modified:   sim/core/unit.go
	modified:   sim/core/utils.go
functions, which are not used anywhere in the codebase.

 On branch stats_refactor
 Changes to be committed:
	modified:   sim/core/test_utils.go
AddHighestStat() versions.

 On branch stats_refactor
 Changes to be committed:
	modified:   sim/core/stats/stats.go
	modified:   sim/core/unit.go
 On branch stats_refactor
 Changes to be committed:
	modified:   sim/core/avoid_dr.go
	modified:   sim/core/buffs.go
	modified:   sim/core/consumes.go
	modified:   sim/core/database.go
	modified:   sim/core/energy.go
	modified:   sim/core/focus.go
	modified:   sim/core/major_cooldown.go
	modified:   sim/core/mana.go
	modified:   sim/core/professions.go
	modified:   sim/core/racials.go
	modified:   sim/core/runic_power.go
	modified:   sim/core/spell.go
	modified:   sim/core/spell_mod.go
	modified:   sim/core/spell_result.go
	modified:   sim/core/statweight.go
	modified:   sim/core/test_utils.go
	modified:   sim/core/unit.go
 On branch stats_refactor
 Changes to be committed:
	modified:   sim/warrior/arms/talents.go
	modified:   sim/warrior/fury/fury.go
	modified:   sim/warrior/fury/glyphs.go
	modified:   sim/warrior/fury/talents.go
	modified:   sim/warrior/glyphs.go
	modified:   sim/warrior/items.go
	modified:   sim/warrior/protection/glyphs.go
	modified:   sim/warrior/protection/protection.go
	modified:   sim/warrior/protection/talents.go
	modified:   sim/warrior/recklessness.go
	modified:   sim/warrior/shield_block.go
	modified:   sim/warrior/talents.go
	modified:   sim/warrior/warrior.go
 On branch stats_refactor
 Changes to be committed:
	modified:   sim/druid/druid.go
	modified:   sim/druid/ferocious_bite.go
	modified:   sim/druid/force_of_nature.go
	modified:   sim/druid/forms.go
	modified:   sim/druid/items.go
	modified:   sim/druid/lacerate.go
	modified:   sim/druid/pulverize.go
	modified:   sim/druid/rake.go
	modified:   sim/druid/ravage.go
	modified:   sim/druid/rip.go
	modified:   sim/druid/savage_defense.go
	modified:   sim/druid/starfire.go
	modified:   sim/druid/talents.go
	modified:   sim/druid/wrath.go
 On branch stats_refactor
 Changes to be committed:
	modified:   sim/warlock/demon_soul.go
	modified:   sim/warlock/demonology/hand_of_guldan.go
	modified:   sim/warlock/doomguard.go
	modified:   sim/warlock/ebon_imp.go
	modified:   sim/warlock/infernal.go
	modified:   sim/warlock/pets.go
	modified:   sim/warlock/talents_affliction.go
	modified:   sim/warlock/talents_destruction.go
StatCapConfig proto messages without as much boilerplate.

 On branch stats_refactor
 Changes to be committed:
	modified:   ui/core/components/suggest_reforges_action.tsx
	modified:   ui/core/individual_sim_ui.tsx
	modified:   ui/core/player.ts
	modified:   ui/core/proto_utils/stats.ts
	modified:   ui/druid/guardian/sim.ts
	modified:   ui/mage/arcane/sim.ts
	modified:   ui/mage/fire/sim.tsx
	modified:   ui/rogue/assassination/sim.ts
	modified:   ui/rogue/combat/sim.ts
	modified:   ui/rogue/subtlety/sim.ts
	modified:   ui/warlock/affliction/sim.ts
	modified:   ui/warlock/demonology/sim.ts
	modified:   ui/warrior/fury/sim.ts
to facilitate cleaning up this code.

 On branch stats_refactor
 Changes to be committed:
	modified:   ui/core/components/suggest_reforges_action.tsx
	modified:   ui/core/encounter.ts
	modified:   ui/core/individual_sim_ui.tsx
	modified:   ui/core/proto_utils/stats.ts
 On branch stats_refactor
 Changes to be committed:
	modified:   ui/paladin/protection/sim.ts
feature for Cata, it will need a full overhaul to look more like Suggest
Reforges, so the old code is not useful.

 On branch stats_refactor
 Changes to be committed:
	deleted:    ui/core/components/suggest_gems_action.ts
 On branch stats_refactor
 Changes to be committed:
	modified:   ui/core/components/inputs/buffs_debuffs.ts
	modified:   ui/core/components/inputs/consumables.ts
 On branch stats_refactor
 Changes to be committed:
	modified:   ui/core/components/individual_sim_ui/reforge_summary.tsx
 On branch stats_refactor
 Changes to be committed:
	modified:   ui/core/components/gear_picker/gear_picker.tsx
	modified:   ui/core/components/gear_picker/selector_modal.tsx
 On branch stats_refactor
 Changes to be committed:
	modified:   ui/core/components/exporters.tsx
 On branch stats_refactor
 Changes to be committed:
	modified:   ui/core/components/encounter_picker.ts
 On branch stats_refactor
 Changes to be committed:
	modified:   ui/core/components/character_stats.tsx
	modified:   ui/core/proto_utils/stats.ts
display stats filtering to eliminate unnecessary creation of new
UnitStat objects.

 On branch stats_refactor
 Changes to be committed:
	modified:   ui/core/components/character_stats.tsx
	modified:   ui/core/proto_utils/names.ts
	modified:   ui/core/proto_utils/stats.ts
from version 1 to 2.

 On branch stats_refactor
 Changes to be committed:
	modified:   proto/common.proto
	modified:   sim/core/TestProtoVersioning.results
	modified:   ui/core/proto_utils/stats.ts
	modified:   ui/core/proto_utils/utils.ts
custom clone method for StatCap objects since structuredClone was not
working, and (2) removed Spirit from configurable stat caps since it
does not have a sensible Rating vs. Percent representation for
visualization.

 On branch stats_refactor
 Changes to be committed:
	modified:   ui/core/components/suggest_reforges_action.tsx
	modified:   ui/core/proto_utils/stats.ts
they are never saved to local storage or links.

 On branch stats_refactor
 Changes to be committed:
	modified:   proto/ui.proto
	modified:   ui/core/individual_sim_ui.tsx
display of breakpoint EP values.

 On branch stats_refactor
 Changes to be committed:
	modified:   ui/core/components/suggest_reforges_action.tsx
	modified:   ui/core/proto_utils/stats.ts
@NerdEgghead NerdEgghead marked this pull request as ready for review August 16, 2024 04:31
@NerdEgghead NerdEgghead changed the title [WIP] Stat Ratings Refactor Stat Ratings Refactor Aug 16, 2024
@1337LutZ
Copy link
Contributor

Tested in Firefox/Edge (not Chrome because I don't want to migrate my current personal Sim settings) to see if old vs new sims would migrate. Tested most spec sims and encountered no issues.

showing only the percentage component for clarity.

 On branch stats_refactor
 Changes to be committed:
	modified:   ui/core/components/character_stats.tsx
clarity.

 On branch stats_refactor
 Changes to be committed:
	modified:   ui/core/components/suggest_reforges_action.tsx
Copy link
Contributor

@ToxicKevinFerm ToxicKevinFerm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hunter sims looks to be working as expected, and the migration worked well on my machine!

@InDebt
Copy link
Contributor

InDebt commented Aug 17, 2024

For the most part links / old data seems to work properly. There seems to be one "visual" bug only as the dps are the same. This seems only to occur after opening an import link from the "old" sim. i.E. - when loading the preset from within the new sim, the stat breakdown look good.

http://localhost:5173/cata/priest/shadow/#eJy1VF1sFFUUnnPvzO7d07+7l912vBocJsQso01mZ2msG+NOeeqDMTwWHwwmlBjiT8O+6NsWDSkkGJQHZMMLPEBJTIp9sZhglERRaslmHwRNjIZAWoRY5QUSQL33zm6pVUMf6MlM5pzvnPN95/7soschhtdgDCYAPgKYBPgC4BeAGoEJAqcJbOEcBmEYRlTNaYDLAMKSk511mtr6+qvvjO5mhDvyB0DBzzSou+j5mY+P2AsNeqlBMc0b87RwALCTvzdD3QXPp4uHNXxLRYc81XPqa+ru9fyUgtVTOA7YxecWqXtsgw9W4SQg50fnqXv1Sd9WeUsX9PDpebrUcVID109R9/2EXKv18FuqZ6IF7AUlOHHXkHfyD+5Tv92Y5j9fNbDNazMUkV+/Td1xT1NYKvnnDC0cBr+DOWF+qz1iHwQIzhMX8A5Ya2Kb47XhfXQmhh8VU9na4ozp29SElLSRMPiMDIWlUlQshv+0/vC/rL8URaF6i2EUFiP9DaNS8RzZyKZmCT8xS9wz14h39hopHJ8l4SezZPDXJol/a5LhG03yDbEbpONHYl0hX6Zcilk0M7hZP40O0v5iFdchkym02YnP7SVQeHI95gLBHEE/BEtmUGWU8BvVaVAVChJPSIk86GZUkLKlCZAUq4Zo/AART8mNK7NRVXLsZvt6vb/aBqJP5jEb9CgdXWfko7BatsQzMkBPrDfJ1IPkYFjFzDRomXdnHE3Mb3xFRa/MYYevpoxUDZuzZfIx+IoxSpp9u3zFsHf5HW26T286y8Opn2xRxtRbY6Nvju4WaUM49bbI7YGs8SS7QBOsAA/SyU5eOUhELF9YhYL8t0Li1PrEs3JgFQzZFQxHK+J5WX544x7IJ+voDjqZnZwybVJLuLIXu+Ty0javHujpYJPaTLartUz5+DRxGYhMnbSRTN1uu+298KWHfUFeNaZ3JYuTrG63vNZqX5Yj+JJ4EXuDnOY7Z8QvTjo6jzBgcGeZsDnLgSrmg3UKX+Jtw3Q/mPNmf0w6AiVbupjmYguBmbpRuHsP0LlACEumVaGQ0v2/zVkgO34nhXGa/LA3x8da3rZ4P7X8i2QYMiau7YyzSSYXP1Y/ou3bynMJ0qhs2Gns+8rQ3HfablaiQ8QbcZ1grf5uV2mFffFa0NZ2nH8ob7I5ZxfjoSS+U9kOfwNRDSA4

grafik

Unfortunatley I can not reliably reproduce this but I had a couple of occasions where when I use 'Use custom stat weights' for the reforger, after closing the dialog the numbers were suddenly crazy high and just a mess for my hit rating. Had to manualy reset them. Not sure if this has anything todo with this PR though 🤣

Also checked that breakpoints align with the haste shown in the character sheet with https://docs.google.com/spreadsheets/d/17cJJUReg2uz-XxBB3oDWb1kCncdH_-X96mSb0HAu4Ko/copy?gid=497073075#gid=497073075 as reference for shadow. When checking all buffs they align nicely.

Reforging also seems to work properly. So no real issues found except the wanky stat overview for old links

Copy link
Contributor

@hillerstorm hillerstorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great!

@NerdEgghead
Copy link
Contributor Author

For the most part links / old data seems to work properly. There seems to be one "visual" bug only as the dps are the same. This seems only to occur after opening an import link from the "old" sim. i.E. - when loading the preset from within the new sim, the stat breakdown look good.

Does this only happen when the gear in the link contained Bonus Stats? If so, I think I know why - I had to make a choice for how to migrate old MeleeHit and SpellHit fields into the new % PseudoStats, and I opted to multiply rather than divide by the conversion factor so that saved school-specific EP values would translate correctly, but this will cause saved bonus stats to behave wonkily.

 On branch stats_refactor
 Changes to be committed:
	modified:   ui/core/proto_utils/stats.ts
@NerdEgghead NerdEgghead merged commit f0c0589 into master Aug 18, 2024
2 checks passed
@NerdEgghead NerdEgghead deleted the stats_refactor branch August 18, 2024 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants