Skip to content

Commit 867c518

Browse files
committed
Updated substat optimizer to use OnEnergyBurst to calculated needed ER
1 parent 9930829 commit 867c518

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

pkg/optimization/optstats/energy_stats.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ func OptimizerERStat(core *core.Core) (CollectorCustomStats[CustomEnergyStatsBuf
6464
return false
6565
}, "substat-opt-energy-log")
6666

67-
core.Events.Subscribe(event.OnBurst, func(_ ...interface{}) bool {
68-
char := core.Player.ActiveChar()
67+
core.Events.Subscribe(event.OnEnergyBurst, func(args ...interface{}) bool {
68+
char := args[0].(*character.CharWrapper)
6969
ind := char.Index
70+
amount := args[2].(float64)
7071

7172
wERsum := 0.0
7273
wsum := 0.0
@@ -82,7 +83,7 @@ func OptimizerERStat(core *core.Core) (CollectorCustomStats[CustomEnergyStatsBuf
8283

8384
erNeeded := 999999999999.9
8485
if charRawParticles[ind] > 0 {
85-
erNeeded = max((char.EnergyMax-charFlatEnergy[ind])/charRawParticles[ind], 1.0)
86+
erNeeded = max((amount-charFlatEnergy[ind])/charRawParticles[ind], 1.0)
8687
}
8788
erPerParticleEvent[ind] = nil
8889
rawPerParticleEvent[ind] = nil

0 commit comments

Comments
 (0)