Skip to content

Commit

Permalink
Merge pull request #3763 from vigo2/vigo/more-dk-refactoring
Browse files Browse the repository at this point in the history
vigo/more-dk-refactoring
  • Loading branch information
vigo2 committed Sep 28, 2023
2 parents 824452a + 8f045b9 commit 9091cfe
Show file tree
Hide file tree
Showing 19 changed files with 416 additions and 453 deletions.
24 changes: 0 additions & 24 deletions sim/core/cast.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,6 @@ func (spell *Spell) makeCastFunc(config CastConfig) CastSuccessFunc {
if config.CD.Timer != nil {
// By panicking if spell is on CD, we force each sim to properly check for their own CDs.
if !spell.CD.IsReady(sim) {
if spell.Unit.PseudoStats.GracefulCastCDFailures {
if sim.Log != nil {
sim.Log("Failed cast because of CD")
}
return false
}
panic(fmt.Sprintf("Trying to cast %s but is still on cooldown for %s, curTime = %s", spell.ActionID, spell.CD.TimeToReady(sim), sim.CurrentTime))
}
spell.CD.Set(sim.CurrentTime + spell.CurCast.CastTime + spell.CD.Duration)
Expand All @@ -122,12 +116,6 @@ func (spell *Spell) makeCastFunc(config CastConfig) CastSuccessFunc {
if config.SharedCD.Timer != nil {
// By panicking if spell is on CD, we force each sim to properly check for their own CDs.
if !spell.SharedCD.IsReady(sim) {
if spell.Unit.PseudoStats.GracefulCastCDFailures {
if sim.Log != nil {
sim.Log("Failed cast because of SharedCD")
}
return false
}
panic(fmt.Sprintf("Trying to cast %s but is still on shared cooldown for %s, curTime = %s", spell.ActionID, spell.SharedCD.TimeToReady(sim), sim.CurrentTime))
}
spell.SharedCD.Set(sim.CurrentTime + spell.CurCast.CastTime + spell.SharedCD.Duration)
Expand Down Expand Up @@ -221,12 +209,6 @@ func (spell *Spell) makeCastFuncSimple() CastSuccessFunc {
if spell.CD.Timer != nil {
// By panicking if spell is on CD, we force each sim to properly check for their own CDs.
if !spell.CD.IsReady(sim) {
if spell.Unit.PseudoStats.GracefulCastCDFailures {
if sim.Log != nil {
sim.Log("Failed cast because of CD")
}
return false
}
panic(fmt.Sprintf("Trying to cast %s but is still on cooldown for %s, curTime = %s", spell.ActionID, spell.CD.TimeToReady(sim), sim.CurrentTime))
}

Expand All @@ -236,12 +218,6 @@ func (spell *Spell) makeCastFuncSimple() CastSuccessFunc {
if spell.SharedCD.Timer != nil {
// By panicking if spell is on CD, we force each sim to properly check for their own CDs.
if !spell.SharedCD.IsReady(sim) {
if spell.Unit.PseudoStats.GracefulCastCDFailures {
if sim.Log != nil {
sim.Log("Failed cast because of SharedCD")
}
return false
}
panic(fmt.Sprintf("Trying to cast %s but is still on shared cooldown for %s, curTime = %s", spell.ActionID, spell.SharedCD.TimeToReady(sim), sim.CurrentTime))
}

Expand Down
19 changes: 5 additions & 14 deletions sim/core/rage.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,17 @@ func (unit *Unit) EnableRageBar(options RageBarOptions, onRageGain OnRageGain) {
if result.Outcome.Matches(OutcomeMiss) {
return
}
if !spell.ProcMask.Matches(ProcMaskMelee) {
return
}
if !spell.ProcMask.Matches(ProcMaskWhiteHit) {
return
}

// Need separate check to exclude auto replacers (e.g. Heroic Strike and Cleave).
if spell.ProcMask.Matches(ProcMaskMeleeMHSpecial) {
return
}

var hitFactor float64
var speed float64
if spell.IsMH() {
if spell.ProcMask == ProcMaskMeleeMHAuto {
hitFactor = 3.5
speed = options.MHSwingSpeed
} else {
} else if spell.ProcMask == ProcMaskMeleeOHAuto {
hitFactor = 1.75
speed = options.OHSwingSpeed
} else {
return
}

if result.Outcome.Matches(OutcomeCrit) {
Expand Down Expand Up @@ -162,7 +153,7 @@ func (rb *rageBar) SpendRage(sim *Simulation, amount float64, metrics *ResourceM
rb.currentRage = newRage
}

func (rb *rageBar) reset(sim *Simulation) {
func (rb *rageBar) reset(_ *Simulation) {
if rb.unit == nil {
return
}
Expand Down
Loading

0 comments on commit 9091cfe

Please sign in to comment.