Skip to content

Commit

Permalink
Make sure to clone breakpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
1337LutZ committed Jul 16, 2024
1 parent 728ec43 commit f7ecaca
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ui/core/components/suggest_reforges_action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export class ReforgeOptimizer {
}

get softCapsConfig() {
return this.updateSoftCaps?.(this._softCapsConfig) || this._softCapsConfig;
return this.updateSoftCaps?.(structuredClone(this._softCapsConfig)) || this._softCapsConfig;
}

get statCaps() {
Expand Down
25 changes: 15 additions & 10 deletions ui/mage/fire/sim.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { CharacterStats } from '../../core/components/character_stats';
import * as OtherInputs from '../../core/components/inputs/other_inputs';
import { ReforgeOptimizer } from '../../core/components/suggest_reforges_action';
import * as Mechanics from '../../core/constants/mechanics';
Expand Down Expand Up @@ -180,8 +179,9 @@ export class FireMageSimUI extends IndividualSimUI<Spec.SpecFireMage> {
);

this.individualConfig.defaults.softCapBreakpoints!.forEach(softCap => {
if (softCap.stat === Stat.StatSpellHaste) {
const adjustedHastedBreakpoints = new Set(softCap.breakpoints.slice());
const softCapToModify = softCaps.find(sc => sc.stat === softCap.stat);
if (softCap.stat === Stat.StatSpellHaste && softCapToModify) {
const adjustedHastedBreakpoints = new Set([...softCap.breakpoints]);
// LvB/Pyro are not worth adjusting for
const excludedHasteBreakpoints = [
hasteBreakpoints.get('5-tick LvB/Pyro')!,
Expand Down Expand Up @@ -216,7 +216,7 @@ export class FireMageSimUI extends IndividualSimUI<Spec.SpecFireMage> {
}
}
});
softCap.breakpoints = [...adjustedHastedBreakpoints].sort((a, b) => a - b);
softCapToModify.breakpoints = [...adjustedHastedBreakpoints].sort((a, b) => a - b);
}
});
return softCaps;
Expand All @@ -226,14 +226,19 @@ export class FireMageSimUI extends IndividualSimUI<Spec.SpecFireMage> {
const hasBL = !!player.getRaid()?.getBuffs()?.bloodlust;
const hasPI = !!player.getBuffs().powerInfusionCount;
const hasBerserking = player.getRace() === Race.RaceTroll;

return (
<>
<p className="mb-0">Additional breakpoints have been created using the following cooldowns:</p>
<ul className="mb-0">
{hasBL && <li>Bloodlust</li>}
{hasPI && <li>Power Infusion</li>}
{hasBerserking && <li>Berserking</li>}
</ul>
{(hasBL || hasPI || hasBerserking) && (
<>
<p className="mb-0">Additional breakpoints have been created using the following cooldowns:</p>
<ul className="mb-0">
{hasBL && <li>Bloodlust</li>}
{hasPI && <li>Power Infusion</li>}
{hasBerserking && <li>Berserking</li>}
</ul>
</>
)}
</>
);
},
Expand Down

0 comments on commit f7ecaca

Please sign in to comment.