Skip to content

Commit

Permalink
Merge pull request #1259 from wowsims/on_use_trinkets
Browse files Browse the repository at this point in the history
On use trinkets
  • Loading branch information
Alexandre-M-Silva authored Oct 11, 2022
2 parents a3fe5e7 + cfb8766 commit e71aa2c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 9 deletions.
4 changes: 2 additions & 2 deletions sim/deathknight/dps/TestFrost.results
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ dps_results: {
dps_results: {
key: "TestFrost-AllItems-IncisorFragment-37723"
value: {
dps: 7761.73661
tps: 4595.72263
dps: 7765.96554
tps: 4598.25999
}
}
dps_results: {
Expand Down
40 changes: 33 additions & 7 deletions sim/deathknight/dps/rotation_frost.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ type FrostRotation struct {
indestructiblePotionMCD *core.MajorCooldown
potionUsed bool

onUseTrinkets []*core.MajorCooldown

oblitRPRegen float64
}

func (fr *FrostRotation) Initialize(dk *DpsDeathknight) {
fr.oblitRPRegen = core.TernaryFloat64(dk.HasSetBonus(deathknight.ItemSetScourgeborneBattlegear, 4), 25.0, 20.0)
fr.onUseTrinkets = make([]*core.MajorCooldown, 0)
}

func (fr *FrostRotation) Reset(sim *core.Simulation) {
Expand All @@ -41,10 +44,22 @@ func (fr *FrostRotation) Reset(sim *core.Simulation) {
fr.berserkingMCD = nil
fr.potionOfSpeedMCD = nil
fr.indestructiblePotionMCD = nil
fr.onUseTrinkets = nil
fr.potionUsed = false
}

func (dk *DpsDeathknight) getFrostMajorCooldown(actionID core.ActionID) *core.MajorCooldown {
func (dk *DpsDeathknight) addOnUseTrinketCooldown(actionID core.ActionID) {
if dk.Character.HasMajorCooldown(actionID) {
majorCd := dk.Character.GetMajorCooldown(actionID)
majorCd.ShouldActivate = func(sim *core.Simulation, character *core.Character) bool {
return false
}

dk.fr.onUseTrinkets = append(dk.fr.onUseTrinkets, majorCd)
}
}

func (dk *DpsDeathknight) getMajorCooldown(actionID core.ActionID) *core.MajorCooldown {
if dk.Character.HasMajorCooldown(actionID) {
majorCd := dk.Character.GetMajorCooldown(actionID)
majorCd.ShouldActivate = func(sim *core.Simulation, character *core.Character) bool {
Expand All @@ -59,22 +74,29 @@ func (dk *DpsDeathknight) setupUnbreakableArmorCooldowns() {
fr := &dk.fr

// hyperspeed accelerators
fr.hyperSpeedMCD = dk.getFrostMajorCooldown(core.ActionID{SpellID: 54758})
fr.hyperSpeedMCD = dk.getMajorCooldown(core.ActionID{SpellID: 54758})

// stoneform (dwarf)
fr.stoneformMCD = dk.getFrostMajorCooldown(core.ActionID{SpellID: 20594})
fr.stoneformMCD = dk.getMajorCooldown(core.ActionID{SpellID: 20594})

// bloodfury (orc)
fr.bloodfuryMCD = dk.getFrostMajorCooldown(core.ActionID{SpellID: 33697})
fr.bloodfuryMCD = dk.getMajorCooldown(core.ActionID{SpellID: 33697})

// berserking (troll)
fr.berserkingMCD = dk.getFrostMajorCooldown(core.ActionID{SpellID: 26297})
fr.berserkingMCD = dk.getMajorCooldown(core.ActionID{SpellID: 26297})

// potion of speed
fr.potionOfSpeedMCD = dk.getFrostMajorCooldown(core.ActionID{ItemID: 40211})
fr.potionOfSpeedMCD = dk.getMajorCooldown(core.ActionID{ItemID: 40211})

// indestructible potion
fr.indestructiblePotionMCD = dk.getFrostMajorCooldown(core.ActionID{ItemID: 40093})
fr.indestructiblePotionMCD = dk.getMajorCooldown(core.ActionID{ItemID: 40093})

// On use trinkets
dk.addOnUseTrinketCooldown(core.ActionID{ItemID: 40531}) // Mark of nogganon
dk.addOnUseTrinketCooldown(core.ActionID{ItemID: 37166}) // Sphere of Red Dragon's Blood
dk.addOnUseTrinketCooldown(core.ActionID{ItemID: 37723}) // Incisor Fragment
dk.addOnUseTrinketCooldown(core.ActionID{ItemID: 39257}) // Loatheb's Shadow
dk.addOnUseTrinketCooldown(core.ActionID{ItemID: 44014}) // Fezzik's Pocketwatch
}

func (dk *DpsDeathknight) castMajorCooldown(mcd *core.MajorCooldown, sim *core.Simulation, target *core.Unit) {
Expand Down Expand Up @@ -123,6 +145,10 @@ func (dk *DpsDeathknight) castAllMajorCooldowns(sim *core.Simulation) {
dk.castMajorCooldown(fr.stoneformMCD, sim, target)
dk.castMajorCooldown(fr.bloodfuryMCD, sim, target)
dk.castMajorCooldown(fr.berserkingMCD, sim, target)

for _, trinket := range fr.onUseTrinkets {
dk.castMajorCooldown(trinket, sim, target)
}
}

func (dk *DpsDeathknight) RotationActionCallback_UA_Frost(sim *core.Simulation, target *core.Unit, s *deathknight.Sequence) time.Duration {
Expand Down

0 comments on commit e71aa2c

Please sign in to comment.