Skip to content

Commit

Permalink
Merge pull request #770 from wowsims/fix-ea
Browse files Browse the repository at this point in the history
Fix everlasting corruption
  • Loading branch information
rosenrusinov authored May 17, 2024
2 parents 1f1070f + 3aa255f commit 60d9a1f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
20 changes: 13 additions & 7 deletions sim/warlock/apl_values.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,26 +114,32 @@ func (value *APLValueWarlockShouldRefreshCorruption) GetBool(sim *core.Simulatio
warlock := value.warlock
target := value.target.Get()

dot := warlock.Corruption.Dot(target)
if !dot.IsActive() {
var dot *core.Dot
for _, spell := range warlock.Corruption {
dot = spell.Dot(target)
if dot.IsActive() {
break
}
}
if dot == nil || !dot.IsActive() {
return true
}

attackTable := warlock.AttackTables[target.UnitIndex][dot.Spell.CastType]

// check if reapplying corruption is worthwhile
snapshotCrit := dot.SnapshotCritChance
snapshotMult := dot.SnapshotAttackerMultiplier * (snapshotCrit*(warlock.Corruption.CritMultiplier(attackTable)-1) + 1)
snapshotMult := dot.SnapshotAttackerMultiplier * (snapshotCrit*(dot.Spell.CritMultiplier(attackTable)-1) + 1)

curCrit := warlock.Corruption.SpellCritChance(target)
curDmg := dot.Spell.AttackerDamageMultiplier(attackTable) * (curCrit*(warlock.Corruption.CritMultiplier(attackTable)-1) + 1)
curCrit := dot.Spell.SpellCritChance(target)
curDmg := dot.Spell.AttackerDamageMultiplier(attackTable) * (curCrit*(dot.Spell.CritMultiplier(attackTable)-1) + 1)

relDmgInc := curDmg / snapshotMult

snapshotDmg := warlock.Corruption.ExpectedTickDamageFromCurrentSnapshot(sim, target)
snapshotDmg := dot.Spell.ExpectedTickDamageFromCurrentSnapshot(sim, target)
snapshotDmg *= float64(sim.GetRemainingDuration()) / float64(dot.TickPeriod())
snapshotDmg *= relDmgInc - 1
snapshotDmg -= warlock.Corruption.ExpectedTickDamageFromCurrentSnapshot(sim, target)
snapshotDmg -= dot.Spell.ExpectedTickDamageFromCurrentSnapshot(sim, target)

//if sim.Log != nil {
// warlock.Log(sim, "Relative Corruption Inc: [%.2f], expected dmg gain: [%.2f]", relDmgInc, snapshotDmg)
Expand Down
9 changes: 8 additions & 1 deletion sim/warlock/corruption.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,15 @@ func (warlock *Warlock) getCorruptionConfig(rank int) core.SpellConfig {
ExpectedTickDamage: func(sim *core.Simulation, target *core.Unit, spell *core.Spell, useSnapshot bool) *core.SpellResult {
if useSnapshot {
dot := spell.Dot(target)
if hasPandemicRune {
return dot.CalcSnapshotDamage(sim, target, dot.Spell.OutcomeExpectedMagicCrit)
}
return dot.CalcSnapshotDamage(sim, target, dot.Spell.OutcomeExpectedMagicAlwaysHit)
} else {
baseDamage := baseDamage / float64(ticks)
if hasPandemicRune {
return spell.CalcPeriodicDamage(sim, target, baseDamage, spell.OutcomeExpectedMagicCrit)
}
return spell.CalcPeriodicDamage(sim, target, baseDamage, spell.OutcomeExpectedMagicAlwaysHit)
}
},
Expand All @@ -103,11 +109,12 @@ func (warlock *Warlock) getCorruptionConfig(rank int) core.SpellConfig {
func (warlock *Warlock) registerCorruptionSpell() {
maxRank := 7

warlock.Corruption = make([]*core.Spell, 0)
for i := 1; i <= maxRank; i++ {
config := warlock.getCorruptionConfig(i)

if config.RequiredLevel <= int(warlock.Level) {
warlock.Corruption = warlock.GetOrRegisterSpell(config)
warlock.Corruption = append(warlock.Corruption, warlock.GetOrRegisterSpell(config))
}
}
}
6 changes: 4 additions & 2 deletions sim/warlock/runes.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ func (warlock *Warlock) EverlastingAfflictionRefresh(sim *core.Simulation, targe
return
}

if warlock.Corruption.Dot(target).IsActive() {
warlock.Corruption.Dot(target).Rollover(sim)
for _, spell := range warlock.Corruption {
if spell.Dot(target).IsActive() {
spell.Dot(target).Rollover(sim)
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion sim/warlock/warlock.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type Warlock struct {

ChaosBolt *core.Spell
Conflagrate *core.Spell
Corruption *core.Spell
Corruption []*core.Spell
DarkPact *core.Spell
DrainSoul *core.Spell
Haunt *core.Spell
Expand Down

0 comments on commit 60d9a1f

Please sign in to comment.