Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 15 PPM proc rate for JoW instead of 50% chance #1687

Merged
merged 1 commit into from
Nov 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions sim/core/attack.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,27 @@ func (aa *AutoAttacks) NewPPMManager(ppm float64, procMask ProcMask) PPMManager
return ppmm
}

// Returns whether a PPM-based effect procced.
//
// Using NewPPMManager() is preferred; this function should only be used when
// the attacker is not known at initialization time.
func (aa *AutoAttacks) PPMProc(sim *Simulation, ppm float64, procMask ProcMask, label string) bool {
if !aa.IsEnabled() {
return false
}

procChance := 0.0
if procMask.Matches(ProcMaskMeleeMH) {
procChance = ppm * aa.MH.SwingSpeed / 60.0
} else if procMask.Matches(ProcMaskMeleeOH) {
procChance = ppm * aa.OH.SwingSpeed / 60.0
} else if procMask.Matches(ProcMaskRanged) {
procChance = ppm * aa.Ranged.SwingSpeed / 60.0
}

return procChance > 0 && sim.RandomFloat(label) < procChance
}

func (unit *Unit) applyParryHaste() {
if !unit.PseudoStats.ParryHaste || !unit.AutoAttacks.IsEnabled() {
return
Expand Down
29 changes: 17 additions & 12 deletions sim/core/debuffs.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@ func JudgementOfWisdomAura(target *Unit) *Aura {
ActionID: actionID,
Duration: time.Second * 20,
OnSpellHitTaken: func(aura *Aura, sim *Simulation, spell *Spell, result *SpellResult) {
unit := spell.Unit
if !unit.HasManaBar() {
return
}

if spell.ProcMask.Matches(ProcMaskEmpty) {
return // Phantom spells (Romulo's, Lightning Capacitor, etc) don't proc JoW.
}
Expand All @@ -245,18 +250,22 @@ func JudgementOfWisdomAura(target *Unit) *Aura {
return
}

unit := spell.Unit
if unit.HasManaBar() && sim.RandomFloat("jow") > 0.5 {
if unit.JowManaMetrics == nil {
unit.JowManaMetrics = unit.NewManaMetrics(actionID)
if spell.ProcMask.Matches(ProcMaskMeleeOrRanged) {
if !unit.AutoAttacks.PPMProc(sim, 15, spell.ProcMask, "jow") {
return
}
} else {
// TODO: Figure out if spell proc rate is also different from TBC.
if sim.RandomFloat("jow") <= 0.5 {
return
}
// JoW returns 2% of base mana 50% of the time.
unit.AddMana(sim, unit.BaseMana*0.02, unit.JowManaMetrics, false)
}

if spell.ActionID.SpellID == 35395 { // Crusader strike
aura.Refresh(sim)
if unit.JowManaMetrics == nil {
unit.JowManaMetrics = unit.NewManaMetrics(actionID)
}
// JoW returns 2% of base mana 50% of the time.
unit.AddMana(sim, unit.BaseMana*0.02, unit.JowManaMetrics, false)
},
})
}
Expand All @@ -274,10 +283,6 @@ func JudgementOfLightAura(target *Unit) *Aura {
if !spell.ProcMask.Matches(ProcMaskMelee) || !result.Landed() {
return
}

if spell.ActionID.SpellID == 35395 {
aura.Refresh(sim)
}
},
})
}
Expand Down
Loading