wowsims / wotlk

World of Warcraft Wrath of the Lich King Classic simulations.
https://wowsims.github.io/wotlk/
MIT License
146 stars 135 forks source link

Reforging in core for Cata #4226

Closed ToxicKevinFerm closed 6 months ago

ToxicKevinFerm commented 6 months ago

RFC: Reforging

Background

With Cataclysm on the horizon, I thought it's time to start adding functionality. Reforging is one of those we can add easily without disturbing other things in the core sim. The functionality of reforging is quite simple. The main issue will be implementing the UI to work with it.

Example item loadout with reforging:

{"items": [
    {"id":51286,"enchant":3817,"gems":[41398,40112]},
    {"id":50633,"gems":[40112]},
    {"id":51288,"enchant":3808,"gems":[40112]},
    {"id":47546,"enchant":3605,"gems":[42143]},
    {"id":51289,"enchant":3832,"gems":[40112,40112]},
    {"id":50655,"enchant":3845,"gems":[40112,0]},
    {"id":51285,"enchant":3604,"gems":[40112,0]},
    {"id":50688,"enchant":3601,"gems":[40148,42143,42143]},
    {"id":50645,"enchant":3823,"gems":[49110,40112,40150]},
    {"id":54577,"enchant":3606,"gems":[40148,40148]},
    {"id":50618,"gems":[45879]},
    {"id":54576,"gems":[40148]},
    {"id":50363},
    {"id":54590},
    {"id":50735,"enchant":3827,"gems":[40112,40112,40112]},
    {},
    {"id":50733,"enchant":3608,"gems":[40112], "reforging":115}
]}

Everything here is optional, so it shouldn't affect current sims at all.

How reforging works

Reforging takes a secondary stat on the item from a list of allowed stats:

Then it takes 40% and adds it to another allowed stat and floors the result. Relevant code from Simulationcraft:

  reforged_from = s1;
  reforged_to   = s2;

  double amount = floor( base_stats.get_stat( reforged_from ) * 0.4 );
  stats.add_stat( reforged_from, -amount );
  stats.add_stat( reforged_to,    amount );

  is_reforged   = true;

Implementation

Found reforging ids on https://www.wowhead.com/tooltips and the object structure WH are likely to use at https://web.archive.org/web/20120201045249js_/http://www.wowhead.com/data=item-scaling

Todo

kayla-glick commented 6 months ago

Forked the Cata repo from this branch https://github.com/wowsims/cata. Closing this PR 🙏