diff --git a/sim/core/apl_values_runes.go b/sim/core/apl_values_runes.go index 71cacc9f76..aa1ce0d164 100644 --- a/sim/core/apl_values_runes.go +++ b/sim/core/apl_values_runes.go @@ -193,11 +193,11 @@ func (value *APLValueNextRuneCooldown) GetDuration(sim *Simulation) time.Duratio returnValue := time.Duration(0) switch value.runeType { case proto.APLValueRuneType_RuneBlood: - returnValue = value.unit.SpentBloodRuneReadyAt() - sim.CurrentTime + returnValue = value.unit.NextBloodRuneReadyAt(sim) - sim.CurrentTime case proto.APLValueRuneType_RuneFrost: - returnValue = value.unit.SpentFrostRuneReadyAt() - sim.CurrentTime + returnValue = value.unit.NextFrostRuneReadyAt(sim) - sim.CurrentTime case proto.APLValueRuneType_RuneUnholy: - returnValue = value.unit.SpentUnholyRuneReadyAt() - sim.CurrentTime + returnValue = value.unit.NextUnholyRuneReadyAt(sim) - sim.CurrentTime } return MaxDuration(0, returnValue) } diff --git a/sim/core/runic_power.go b/sim/core/runic_power.go index ba8626eca6..4dff354435 100644 --- a/sim/core/runic_power.go +++ b/sim/core/runic_power.go @@ -431,6 +431,30 @@ func (rp *RunicPowerBar) UnholyRuneReadyAt(sim *Simulation) time.Duration { return MinDuration(rp.runeMeta[4].regenAt, rp.runeMeta[5].regenAt) } +func (rp *RunicPowerBar) NextRuneTypeReadyAt(sim *Simulation, left int8, right int8) time.Duration { + if rp.runeStates&isSpents[left] != isSpents[left] && rp.runeStates&isSpents[right] != isSpents[right] { + // Both are ready so return current time + return sim.CurrentTime + } else if rp.runeStates&isSpents[left] == isSpents[left] || rp.runeStates&isSpents[right] == isSpents[right] { + // One is spent so return the time it will regen at + return MinDuration(rp.runeMeta[left].regenAt, rp.runeMeta[right].regenAt) + } + // Both are spent so return the last one to regen at + return MaxDuration(rp.runeMeta[left].regenAt, rp.runeMeta[right].regenAt) +} + +func (rp *RunicPowerBar) NextBloodRuneReadyAt(sim *Simulation) time.Duration { + return rp.NextRuneTypeReadyAt(sim, 0, 1) +} + +func (rp *RunicPowerBar) NextFrostRuneReadyAt(sim *Simulation) time.Duration { + return rp.NextRuneTypeReadyAt(sim, 2, 3) +} + +func (rp *RunicPowerBar) NextUnholyRuneReadyAt(sim *Simulation) time.Duration { + return rp.NextRuneTypeReadyAt(sim, 4, 5) +} + // AnySpentRuneReadyAt returns the next time that a rune will regenerate. // // It will be NeverExpires if there is no rune pending regeneration.