Skip to content

Commit

Permalink
fix dk next rune cd
Browse files Browse the repository at this point in the history
  • Loading branch information
rosenrusinov committed Sep 17, 2023
1 parent f08f823 commit 644891a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sim/core/apl_values_runes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
24 changes: 24 additions & 0 deletions sim/core/runic_power.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 644891a

Please sign in to comment.